An integer has $2018$ digits and is divisible by $7$. The first digit is $d$, while all the other digits are $2$. What is the value of $d$?

Let's think step by step and output the final answer within \boxed{}.
user