Effective Infection Time

No attempts yetTime limit2sMemory limit128 MB

Problem

You are estimating the threat level of quarantined zones that have been abandoned to the infection. One of the main variables behind a zone's threat level is its EIT (Effective Infection Time). Planning a strike date to reclaim a quarantined zone requires this number. The EIT follows these rules.

  • The EIT is a function of two dates: the infection date and the strike date.
  • All years are given in A.Z. (After Zombie).
  • A month counts toward the EIT only after its last day has passed, so the month of the strike date never counts.
  • The first calendar year of the infection counts as 1/21/2 EIT.
    • If the end of that year is not reached, each month counts for a share of the 1/21/2 EIT. A zone infected in January of the first year spreads 1/21/2 EIT over 12 months, so one month is (1/2)/120.0417(1/2)/12 \approx 0.0417 EIT. A zone infected in March of the first year spreads 1/21/2 EIT over 10 months, so one month is (1/2)/10=0.0500(1/2)/10 = 0.0500 EIT.
    • If the end of that year is reached, the year counts as the full 1/21/2 EIT no matter which month the infection started. A zone infected in February of 15 A.Z. counts as exactly 1/21/2 EIT once December 15 A.Z. has passed, and a zone infected in December of that same year counts as 1/21/2 EIT too.
  • Every following year counts as 11 EIT. Starting from January, each calendar month is worth 1/120.08331/12 \approx 0.0833 EIT.
  • Zones infected in the same month share the same EIT for any given strike date, so only the month and the year are given.

The number of months in a year and their order are the same as in the Gregorian calendar we use today.

Input

The first line contains the number of zones NN (1N501 \le N \le 50). Two lines follow for each zone.

  • The first line is the infection date and the second line is the strike date.
  • The first integer of a date is the month MM (1M121 \le M \le 12) and the second integer is the year YY (0000Y00300000 \le Y \le 0030). The year always has 4 digits.
  • The strike date never precedes the infection date.

Output

Print the EIT of each zone on its own line, rounded to the fourth digit after the decimal point. Always print the ones digit, even when it is 00.