URI Online Judge | 1619

Date Difference

By Henrique Pinto, UFMG BR Brazil

Timelimit: 1

Joanna is working on the new version of her company's blog. One of the changes she wants to make is how post dates are displayed. In the current version, dates are displayed in the year-month-day format (e.g. 2014-08-09). She wishes that dates would instead be displayed as the number of days elapsed between the current date and the post date. So, for example, if today is August 9, 2014, then the date 2014-05-23 would be displayed as "78 days ago", and the date 2014-08-07 would be "2 days ago".

Joanna is very busy with some of the more complex problems related to the new blog, and asked you for help with this task. Given two dates, compute the number of days elapsed between them.

Notes

Please remember that leap years have a 366th day (February 29). A year is a leap year if its number is a multiple of 400, or if it is a multiple of 4 but not a multiple of 100.

Input

Input begins with a line containing a single integer N, the number of test cases (0 < N <= 10000). After that, there are N lines, each of which describes a test case.

Each of those lines contains two dates, separated by a single space. Dates are in the YYYY-MM-DD format, where YYYY is the year, MM in the month, and DD is the day. You can assume that all dates in the input are valid (i.e., there won't be any dates like 2013-02-31 in the input). All dates are between 1970 and 2014 (including). The month and day are always given with two digits, with a leading zero if necessary. For example, February 3, 2014 would be in the input as 2014-02-03.

Output

For each test case, print a line containing the absolute value of the number of days elapsed between the two dates.

Sample Input Sample Output

4

2014-07-27 2014-07-25

2014-08-09 2014-05-23

2012-01-01 2013-01-01

1970-01-01 1970-01-01

2

78

366

0