n = 28a+5 n+23 = 28(a+1) ⇒ 28 | (n+23)
n = 35b +12 n+23 = 35(b+1) ⇒ 35 | (n+23)
[28 , 35] = 140 ⇒ 1504 < M140 < 2007
1540 ≤ M140 ≤ 1960
1540 ≤ n+ 23 ≤ 1960
1517 ≤ n ≤1937
S = 1517 + (1517+140·1) + (1517+140·2) +(1517+ 140·3) =
= 1517·4+ 140(1+2+3) = 6908