#Lutece1299. Date

Date

Migrated from Lutece 1299 Date

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

A special day is the day that is xthx^{th} day in that month, and happens to be xthx^{th} day in that week.

In February 1st1^{st} in 20162016, this day in that month happens to be the first day in that week, so we call it a special day.

Now, given a time interval, how many special days in total?

Input

The first line is an integer T(T55)T(T \le 55), denoting the number of test cases.

Then TT lines follows, each test case one line.

Each line contains two dates AA and BB, following such format: year month day.

year109year \le 10^9, monthmonth and dayday will be legal.

AA and BB will all be later than 2016/1/312016/1/31, and BB will not be earlier than AA.

Output

For each query, output the answer in one line.

Samples

2
2016 2 1 2016 2 7
2016 2 1 2022 6 1
7
77

Note

Note that the answer may be large, please using long long

Resources

The 14th UESTC Programming Contest Preliminary