Summer School 2011 in Sevastopol, Day 3
Divisibility by 4
Let aninfinitesequence of numbers, composedas follows:
A0 = 1, A1 = 12,…,A9 = 12345678910, A10 = 1234567891011, ….
That is,each successive termis obtainedby assigningthe sequenceat the endof the previous memberfor decimalnumbers,one greater than thevalue of the indexof theterm of the sequence.
It is necessaryto determine the totalnumber of membersof thesequences thatwithout the restare divisible by 4, among thosewhose indexbelongs to thesegment [m, n], where 0 ≤ m ≤ n ≤ 1018.
The onlyline of the inputfileare given twonon-negative integersm and n.
The onlyline ofthe output filea single integer- the answerof the problem.