1001 -> s=2 2002 -> s=4 9009 -> s=18
1111 -> s=4 2112 -> s=6 9119 -> s=20
1221 -> s=6 ... ...
... 2992 ->s=22 9999 -> s=36
1991 -> s=20
S=2+ 2*4 + 2*6 + 2*8 + ... + 2*34 + 36
S=2*(1 + 2 + 3 + ... + 17 + 18)
Folosim formula [n(n+1)]/2
S=[2*18(18+1)]/2
S=18(18+1)
S=18*19
S=342