407353: GYM102770 A AD 2020

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. AD 2020time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

2020 is the current year and is a leap year starting on Wednesday of the Gregorian calendar, the 2020th year of the Common Era (CE) and Anno Domini (AD) designations, the 20th year of the 3rd millennium, the 20th year of the 21st century, and the 1st year of the 2020s decade.

2020 has been designated as Year of the Nurse and Midwife by the World Health Organization. The United Nations has declared 2020 as the International Year of Plant Health. 2020 has been designated as International Year of Sound by the International Commission for Acoustics.

Because there are so many unforgettable things happening in 2020, somebody has now proposed that all dates with a substring containing "202" to be designated as the Day for Disaster Reduction. We represent a date in the format YYYYMMDD (for example, 21110202), then if 202 is a substring of this date, this day is the Day for Disaster Reduction.

Please write a program to compute how many Days for Disaster Reduction are there in all the dates between $$$Y_1$$$$$$M_1$$$$$$D_1$$$ and $$$Y_2$$$$$$M_2$$$$$$D_2$$$ (both inclusive)? Note that you should take leap years into consideration. A leap year is a year that can be divided by 400 or can be divided by 4 but can't be divided by 100. A leap year has $$$29$$$ days in February, instead of the normal $$$28$$$ days.

Input

The input contains multiple cases. The first line of the input contains a single positive integer $$$T$$$ ($$$1 \le T \le 10^5$$$), the number of cases.

The first and only line of each case contains six integers $$$Y_1,M_1,D_1,Y_2,M_2,D_2$$$, which are described in the problem statement above.

It's guaranteed that $$$Y_1$$$$$$M_1$$$$$$D_1$$$ is not larger than $$$Y_2$$$$$$M_2$$$$$$D_2$$$. Both $$$Y_1$$$$$$M_1$$$$$$D_1$$$ and $$$Y_2$$$$$$M_2$$$$$$D_2$$$ are between 20000101 and 99991231, and both dates are valid.

We kindly remind you that the size of the input and output of this problem can be large, so it's recommended to use a faster I/O method. For example, in C++, you can use scanf/printf instead of cin/cout.

Output

For each case, print a single line containing a single integer, the answer.

ExampleInput
3
2111 02 01 2111 02 03
2202 01 01 2202 12 31
2000 01 01 9999 12 31
Output
1
365
44294
Note

In the first sample case, 21110202 is the only Day for Disaster Reduction.

In the second sample case, 202 is a substring of 2202, so every day in the year 2202 is the Day for Disaster Reduction!

加入题单

算法标签: