This problem is the more-evil-version of this problem.
A normal long tally counter has digits and counts by , hence there are different numbers can be shown on it (in range ).
Suppose you have an odd long tally counter. Instead by , it counts by . In case of overflow, the counter only shows the last digits of the number.
For example, if the counter will show these numbers :
Let be the function returning the number of different numbers can be shown on odd long tally counter with , find the last digits of .
As an explicit example :
This problem is taken from TOKI Open Contest January 2013 (Problemsetter : Me)