When $N = 111\dots1 \times 11\dots1$, what is the sum of all digits of $N$? 
When $N = 111\dots1 \times 111\dots1$, what is the sum of all digits of $N$? Note that the number of ones in both numbers is $1989$. Generalize if possible.

Greetings, I was doing the above question but could not solve it. This problem is tricky. I haven't made any progress on this question. The answer key tells that the answer is $17901$.

Still here's what I've done so far (at least tried so far):
Note that $\underbrace{111\dots111}_{1989\ 1\text{'s}} = \frac19 (10^{1989} - 1)$
We get $N = 11\dots11 × \frac19(10^{1989} − 1)$
I noticed that $$\frac19 \times 111...1 \text{(1989 1's)} = 12345689...123456789$$ with $221$ blocks of $123456789$.
If somehow, we could reduce the expression in terms of $\frac19 \times 111...1$, we would be done.
This is it.
EDIT: As pointed out by Robert Israel in the comments, $$(\frac{10^n−1}{9})^2 = \frac{10^{2n} - 2\cdot 10^ + 1}{81}.$$ Now $\frac{1}{81}$ repeats $.012345679$. So it's reasonable there should be a pattern that depends on $n$ mod $9$ which was pointed out earlier in this post.

Any help would be appreciated. Please try to provide the solution in layman's terms and in the easiest way.
Very Thank You.
 A: From this question, we know that the sum of digits of the square of $S_n:=\sum_{k=0}^{n-1}10^k$ is equal to $81\cdot \left( \left\lfloor \frac{n}{9} \right\rfloor + \left\{\frac{n}{9}\right\}^2 \right)$.
Since $1989=9\cdot221$, we see that the sum of digits of your $N$ is equal to $9\cdot1989=17901$.

Let me try to fill in a little gap in the hint $4$ of the referred answer.
We would like to show that $S_{n+9}^2=10^9\cdot S_n^2+S_9\cdot S_{2n+9}$.
Expanding the sum in $S_{n+9}^2$, we see that, (here a $\sum$ along means summation over $10^{k+\ell}$, abbreviated).
$$\eqalign{S_{n+9}^2&=\sum_{k=0}^{n+8}\sum_{\ell=0}^{n+8}\\
&=\sum_{k=9}^{n+8}\sum_{\ell=0}^{n-1}+\sum_{k=0}^{8}\sum_{\ell=0}^{n-1}+\sum_{k=0}^{n+8}\sum_{\ell=n}^{n+8}\\
&=10^9\cdot S_n^2+\sum_{k=0}^{8}\sum_{\ell=0}^{n-1}+\sum_{k=0}^{n-1}\sum_{\ell=n}^{n+8}+\sum_{k=n}^{n+8}\sum_{\ell=n}^{n+8}\\
&=10^9\cdot S_n^2+\sum_{k=0}^{8}\sum_{\ell=0}^{n-1}+\sum_{k=0}^{8}\sum_{\ell=n}^{2n-1}+\sum_{k=0}^{8}\sum_{\ell=2n}^{2n+8}\\
&=10^9\cdot S_n^2+\sum_{k=0}^8\sum_{\ell=0}^{2n+8}\\
&=10^9\cdot S_n^2+S_9\cdot S_{2n+9}.
}$$

Hope this helps.
A: The hint: 
It's
$$220\cdot37+(45+35)+219\cdot44+45=17901.$$
Number of digits of $N^2$ it's
$$\left[2\log_{10}\frac{10^{1989}-1}{9}\right]+1=3977.$$
Now, our number $N^2$ it's
$$AA...ABCC...CD,$$ where a number of blocks $A$ is equal to number of blocks $C$ plus $1$ and we say about following blocks:
$$A=123456790,$$
$$C=987654320$$ and $$D=987654321.$$
We see that any block as $A$, $C$ and $D$ has $9$ digits.
The block $B$ it's or $0$ or $120$ or $12320$ or $1234320$ ... has odd number of digits and since
$$3977=440\cdot9+17,$$ we obtain:
$$B=12345678987654320.$$
Now, a sum of digits of $A$, $B$, $C$ and $D$ is equal to $37$ ,$80$, $44$ and $45$ respectively and we obtain for the needed sum of digits:
  $$220\cdot37+80+219\cdot44+45=17901.$$
A: Look at the multiplication table:

At the rightmost, $A=\color{red}{987654321}$ is obtained straightforward.
Next, until the borderline of $1989$ (divisible by $9$), the number of addends of $1$ is increasing and the period of $B=\color{green}{987654320}$ is repeating.
At the borderline, $C=\color{blue}{12345678}$ is the result of the change of the number of addends $1$.
After the borderline, the number of addends of $1$ starts to decrease and another period of $D=\color{purple}{123456790}$ is repeating until the leftmost.
Hence:
$$A+xB+C+yD=\\
\color{red}{\frac{1+9}{2}\cdot 9}+\frac{1989-9}{9}\cdot \color{green}{\frac{2+9}{2}\cdot 8}+\color{blue}{\frac{1+8}{2}\cdot 8}+\frac{1989-9}{9}\cdot \left(\color{purple}{\frac{1+7}{2}\cdot 7+9}\right)=\\
45+220\cdot 44+36+220\cdot 37=\\
17,901.$$
