TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given two positive integers, a and b. You have to concatenate all the integers from a to b (inclusive) to form a very, very large number. Calculate this number modulo p.

Input Format

There are multiple test cases.
Each test case consists of a single line containing the three intergers - a, b and p, listed in this order.
Input is terminated by EOF (End of File).


1 <= a <= b <= 1018.

1 <= p <= 109.

Total number of test cases is around 1000.

Output Format

For each test case, output one line - the answer.

Sample Input 1

1 9 17
9 12 23

Sample Output 1

1
12

Hints

Problem Source

Migrated from old NTUJ.

CodeCraft 2010

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200