TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given three integers x,a,b.


Please print (xa+xa+1+xa+2+...+xb) mod 10

Input Format

First line contains a number T, denoting the number of testcases.

Each testcase consists of the three numbers x, a, b in a line.

T<=1500

0 <= x,a,b <= 2147483647

a <= b

Testdatas don't contain 00.

Output Format

For each test case, output a line contains one integer range from 0 to 9(inclusive).

Sample Input 1

3
3 4 5
4 5 6
5 6 8

Sample Output 1

4
0
5

Hints

Do you agree that it's an easy problem?

Problem Source

Migrated from old NTUJ.

dreamoon

Subtasks

No. Testdata Range Score

Testdata and Limits

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