1415 - How many seats

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 194

Solved: 17

Description

As we all know the winter vacation is coming soon, so train tickets are becoming hot again!   (You can see the long waiting line in front of the tickets office). Fortunately our lucky xiaoY has got a ticket back home, but Mr HH who gave xiaoY the ticket placed a hard problem at the same time. Because Mr HH was working on the CRH(和谐号), he needed to know how many seats the CRH could be sold. CRH is designed in a strange way.

1st:        The carriage of index i has the sum of i's all digital seats.

2nd:       From the beginning of the train every 5 carriage is forbidden to take passenger.

3rd:       Give you the index of head-----L, and index of tail-----R, calculate the number of seats could be sold!

Mr HH was tired of this hard math problem, so he turned this problem to xiaoY, Can you help xiaoY solve this problem to back home!

Input

N    ---- Case number (N<=100)

N pair of number followed

L, R ---- head and tail of train. (0=< L<=R<=100000000)

Output

Sum ----- the total seats of CRH could be sold.

sample input
```3
3 5
8 13
1 10
```
sample output
```12
24
40
```
hint

3 + 4 + 5 = 12

8 + 9 + (1+0) + (1+1) + (1+3) = 24 (the 5th number 12 is ignored)

1 + 2 + 3 + 4 + 6 + 7 + 8 + 9 = 40 (the 5th number 5 and the 10th number 10 are ignored)

source
He Jian, HUST Campus 2010, Preliminary
© 2015 HUST ACMICPC TEAM. All Right Reserved.