Let Nr denote the number whose first and last digits are 7 and whose r middle digits are all 5.
Thus the total number of digits is (r+2) and
Nr=7⋅10r+1+5(10r−1+10r−2+⋯+101)+7.
The parenthesis is a geometric series of r terms with first term 10r−1 and ratio 1/10, whose sum equals
910r−1×10.
Therefore
Nr=7⋅10r+1+950(10r−1)+7.
The required sum is
S=∑r=098Nr.
We add S term-wise by separating coefficient-wise parts.
First part (leading 7):
S1=7∑r=09810r+1=70∑r=09810r=70⋅91099−1.
Second part (middle 5’s):
S2=950∑r=098(10r−1)=950(91099−1−99)=8150(1099−892).
Third part (trailing 7):
S3=7×99=693.
Putting A=1099, we get
S=S1+S2+S3=970A−970+8150A−8150⋅892+693=81680A+10903.
Next write the term with 99 middle 5’s, i.e. N99 (the number 75…5799).
Since 10100=10A, we have
N99=7⋅10100+950(1099−1)+7=70A+950A−50+7=9680A+13.
We are told that
S=nN99+m,m,n∈N,m,n<3000.
Substituting the obtained expressions:
81680A+10903=n9680A+13+m.
Cross-multiplying,
n(680A+10903)=9(680A+13)+81m.
Equating coefficients of A gives
680n=9×680⟹n=9.
Equating the constant terms then yields
10903n=117+81m⟹10903×9=117+81m⟹98127=117+81m⟹81m=98010⟹m=1210.
Both m and n are below 3000, so they satisfy the given restriction.
Finally,
m+n=1210+9=1219.
Hence the required value is 1219.