You visit a doctor on a date given in the format $yyyy:mm:dd$. Your doctor suggests you to take pills every alternate day starting from that day. You being a forgetful person are pretty sure won’t be able to remember the last day you took the medicine and would end up in taking  the medicines on wrong days. 
So you come up with the idea of taking medicine on the dates whose day is odd or even depending on whether $dd$ is odd or even. Calculate the number of pills you took on right time before messing up for the first time.

-----Note:-----
Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100; the centurial years that are exactly divisible by 400 are still leap years. For example, the year 1900 is not a leap year; the year 2000 is a leap year.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, in the format $yyyy:mm:dd$

-----Output:-----
For each testcase, output in a single line the required answer.

-----Constraints-----
- $ 1 \leq T \leq 1000 $
- $ 1900 \leq yyyy \leq 2038 $
- $yyyy:mm:dd$ is a valid date

-----Sample Input:-----
1
2019:03:31

-----Sample Output:-----
1

-----EXPLANATION:-----
You can take pill on the right day only on 31st March. Next you will take it on 1st April which is not on the alternate day.

Starter code:

Solutions:
t=int(input())
li1=[31,29,31,30,31,30,31,31,30,31,30,31]
li2=[31,28,31,30,31,30,31,31,30,31,30,31]
for z in range(t):
 y,m,d=list(map(int,input().split(':')))
 if y%4 == 0:
  if y%100 == 0:
   if y%400 == 0:
    li=li1
   else:
    li=li2
  else:
   li=li1
 else:
  li=li2
 c=0
 if d%2 == 0:
  while d%2 == 0:
   c+=1
   d+=2
   if d>li[m-1]:
    d=d%li[m-1]
    m+=1
 else: 
  while d%2 != 0:
   c+=1
   d+=2
   if d>li[m-1]:
    d=d%li[m-1]
    m+=1
 print(c)
   


for _ in range(int(input())):
 a,b,c=map(int,input().split(':'))

 if b in[1,3,5,7,8,10,12]:
  print(int((31-c)/2+1))
  continue
 if b in [4,6,9,11]:
  print(int((61-c)/2+1))
  continue
 if a%400==0 or a%100!=0 and a%4==0:
  print(int((29-c)/2+1))
  continue
 else:
  print(int((59-c)/2+1))
  continue

for _ in range(int(input())):
 EVEN=[4,6,9,11]
 ODD=[1,3,5,7,8,10,12]
 Y,M,D=list(map(int,input().strip().split(":")))
 Ans=0
 if Y%400==0 or (Y%4==0 and Y%100!=0):
  ODD.append(2)
  if M in EVEN:
   if D%2==0:
    Ans=(((30-D)//2)+1)+15
   else:
    Ans=(((30-D)//2)+1)+16
  elif M in ODD:
   if D%2==0:
    if M==2:
     Ans=(((29-D)//2)+1)
    else:
     Ans=(((31-D)//2)+1)
   else:
    if M==2:
     Ans=(((29-D)//2)+1)
    else:
     Ans=(((31-D)//2)+1)
 else:
  EVEN.append(2)
  if M in ODD:
   if D%2==0:
    Ans=(((31-D)//2)+1)
   else:
    Ans=(((31-D)//2)+1)
  elif M in EVEN:
   if D%2==0:
    if M==2:
     Ans=(((28-D)//2)+1)+15
    else:
     Ans=(((30-D)//2)+1)+15
   else:
    if M==2:
     Ans=(((28-D)//2)+1)+16
    else:
     Ans=(((30-D)//2)+1)+16
 print(Ans)
 
  


for _ in range(int(input())):
 y, m, d = list(map(int, input().split(':')))
 if m in [1,3,5,7,8,10,12]:
  print((31 - d) // 2 + 1)
 elif m in [4,6,9,11]:
  print((61 - d) // 2 + 1)
 else:
  if y % 400 == 0 or (y % 4 == 0 and y % 100 != 0):
   print((29 - d) // 2 + 1)
  else:
   print((59 - d) // 2 + 1)


# cook your dish here
for _ in range(int(input())):
 yy,mm,dd = list(map(int, input().split(':')))
 if mm in [1,3,5,7,8,10,12]:
  sum1 = ((31-dd)//2)+1
 elif mm in [4,6,9,11]:
   sum1 = ((61 - dd) // 2) + 1
 else:
  if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0:
   sum1 = ((29 - dd) // 2) + 1
  else:
   sum1 = ((28+31 - dd) // 2)+1
 print(sum1)


# cook your dish here
for _ in range(int(input())):
 yy,mm,dd = map(int, input().split(':'))
 if mm in [1,3,5,7,8,10,12]:
  sum1 = ((31-dd)//2)+1
 elif mm in [4,6,9,11]:
   sum1 = ((61 - dd) // 2) + 1
 else:
  if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0:
   sum1 = ((29 - dd) // 2) + 1
  else:
   sum1 = ((28+31 - dd) // 2)+1
 print(sum1)

for _ in range(int(input())):
 y, m, d = map(int, input().split(':'))
 if m in [1,3,5,7,8,10,12]:
  print((31 - d) // 2 + 1)
 elif m in [4,6,9,11]:
  print((61 - d) // 2 + 1)
 else:
  if y % 400 == 0 or (y % 4 == 0 and y % 100 != 0):
   print((29 - d) // 2 + 1)
  else:
   print((59 - d) // 2 + 1)

for i in range(int(input())):
 y,m,d = list(map(int,input().split(":")))
 if m in [1,3,5,7,8,10,12]:
  sol = ((31-d)//2)+1
 elif m in [4,6,9,11]:
  sol = ((61-d)//2)+1
 else:
  if (y%4==0 and y%100!=0) or y%400==0:
   sol = ((29-d)//2)+1
  else:
   sol = ((59-d)//2)+1
 print(sol) 

# cook your dish here
for i in range(int(input())):
 y,m,d = list(map(int,input().split(":")))
 if m in [1,3,5,7,8,10,12]:
  sol = ((31-d)//2)+1
 elif m in [4,6,9,11]:
  sol = ((61-d)//2)+1
 else:
  if (y%4==0 and y%100!=0) or y%400==0:
   sol = ((29-d)//2)+1
  else:
   sol = ((59-d)//2)+1
 print(sol) 

for i in range(int(input())):
 y,m,d = list(map(int,input().split(":")))
 if m in [1,3,5,7,8,10,12]:
  sol = ((31-d)//2)+1
 elif m in [4,6,9,11]:
  sol = ((61-d)//2)+1
 else:
  if (y%4==0 and y%100!=0) or y%400==0:
   sol = ((29-d)//2)+1
  else:
   sol = ((59-d)//2)+1
 print(sol) 

# cook your dish here
for _ in range(int(input())):
 yy,mm,dd = map(int, input().split(':'))
 if mm in [1,3,5,7,8,10,12]:
  sum1 = ((31-dd)//2)+1
 elif mm in [4,6,9,11]:
   sum1 = ((61 - dd) // 2) + 1
 else:
  if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0:
   sum1 = ((29 - dd) // 2) + 1
  else:
   sum1 = ((28+31 - dd) // 2)+1
 print(sum1)

# cook your dish here
for _ in range(int(input())):
 yy,mm,dd = map(int, input().split(':'))
 if mm in [1,3,5,7,8,10,12]:
  ans = ((31-dd)//2)+1
 elif mm in [4,6,9,11]:
   ans = ((61 - dd) // 2) + 1
 else:
  if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0:
   ans = ((29 - dd) // 2) + 1
  else:
   ans = ((28+31 - dd) // 2)+1
 print(ans)

for _ in range(int(input())):
 yy,mm,dd = map(int, input().split(':'))
 if mm in [1,3,5,7,8,10,12]:
  ans = ((31-dd)//2)+1
 elif mm in [4,6,9,11]:
   ans = ((61 - dd) // 2) + 1
 else:
  if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0:
   ans = ((29 - dd) // 2) + 1
  else:
   ans = ((28+31 - dd) // 2)+1
 print(ans)

from sys import stdin, stdout
ans = []

def leap_check(yy):
 if yy % 400 == 0:
  return True
 elif yy % 100 == 0:
  return False
 elif yy % 4 == 0:
  return True
 else:
  return 0

for _ in range(int(stdin.readline())):
 yy, mm, dd = list(map(int, stdin.readline().split(':')))
 if mm in [1, 3, 5, 7, 8, 10, 12]:
  ans.append(str(int(((31 - dd) / 2) + 1)))
 elif mm in [4, 6, 9, 11]:
  ans.append(str(int(((30 - dd) / 2) + 16 + (dd % 2))))
 else:
  ans.append(str(int((29 - dd) / 2 + 1)
      if leap_check(yy) else int((28 - dd)/2 + 16 + (dd % 2))))
stdout.write('\n'.join(ans))


for i in range(int(input())):
 y,m,d=map(int, input().split(':'))
 if (m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12):
  s=(31-d)//2 + 1
 elif m==4 or m==6 or m==9 or m==11:
  s=(61-d)//2 + 1
 else:
  if (y%4==0 and y%100 !=0)or y%400==0:
   s=(29-d)//2 + 1
  else:
   s=(28+31-d)//2 + 1
 print(s)

# cook your dish here
for _ in range(int(input())):
 y,m,d=list(map(int,input().split(':')))
 if m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:
  if d%2==0:
   print(((30-d)//2)+1)
  else:
   print(((31-d)//2)+1)
 elif m==4 or m==6 or m==9 or m==11:
  if d%2==0:
   print(((30-d)//2)+16)
  else:
   print(((31-d)//2)+16)
 elif (y%4==0 and y%100!=0) or y%400==0:
  print((29 - d)//2 + 1)
 else:
  if d%2==0:
   print(((28-d)//2)+16)
  else:
   print(((27-d)//2)+17)


# cook your dish here
for _ in range(int(input())):
 y,m,d=list(map(int, input().split(':')))
 if (m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12):
  c=(31-d)//2 + 1
 elif m==4 or m==6 or m==9 or m==11:
  c=(61-d)//2 + 1
 else:
  if (y%4==0 and y%100 !=0)or y%400==0:
   c=(29-d)//2 + 1
  else:
   c=(28+31-d)//2 + 1
 print(c)
 


# cook your dish here
for _ in range(int(input())):
 s = input().split(':')
 y = int(s[0])
 m = int(s[1])
 d = int(s[2])
 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  count = (31 - d)//2 + 1
 elif m == 4 or m == 6 or m == 9 or m == 11:
  count = (30 + 31 - d)//2 + 1
 else:
  if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0:
   count = (29 - d)//2 + 1
  else:
   count = (28 + 31 - d)//2 + 1
 print(count)

for i in range(int(input())):
 li = input().split(':')
 y = int(li[0])
 m = int(li[1])
 d = int(li[2])
 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  count = (31 - d)//2 + 1
 elif m == 4 or m == 6 or m == 9 or m == 11:
  count = (30 + 31 - d)//2 + 1
 else:
  if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0:
   count = (29 - d)//2 + 1
  else:
   count = (28 + 31 - d)//2 + 1
 print(count)

# cook your dish here
t = int(input())

for _ in range(t):
 s = input()
 a = s.split(":")
 year = int(a[0])
 m = int(a[1])
 d = int(a[2])

 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  count = (31 - d) // 2 + 1
 elif m == 4 or m == 6 or m == 9 or m == 11:
  count = (30 + 31 - d) // 2 + 1
 else:
  if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
   count = (29 - d) // 2 + 1
  else:
   count = (28 + 31 - d) // 2 + 1

 print(count)
 


# cook your dish here
t = int(input())

for _ in range(t):
 s = input()
 a = s.split(":")
 year = int(a[0])
 m = int(a[1])
 d = int(a[2])

 if m == 2:
  if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
   count = (29 - d) // 2 + 1
  else:
   count = (28 + 31 - d) // 2 + 1

 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  count = (31 - d) // 2 + 1
 elif m == 4 or m == 6 or m == 9 or m == 11:
  count = (30 + 31 - d) // 2 + 1
 print(count)
 


# cook your dish here
t = int(input())


def leapYear(Year):
 if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
  return True
 else:
  return False


for _ in range(t):
 s = input()
 a = s.split(":")
 year = int(a[0])
 m = int(a[1])
 d = int(a[2])

 if m == 2:
  if leapYear(year):
   print((29 - d) // 2 + 1)
  else:
   print((28 + 31 - d) // 2 + 1)

 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  print((31 - d) // 2 + 1)
 elif m == 4 or m == 6 or m == 9 or m == 11:
  print((30 + 31 - d) // 2 + 1)
 


# cook your dish here
t = int(input())


def leapYear(Year):
 if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
  return True
 else:
  return False


for _ in range(t):
 s = input()
 a = s.split(":")
 year = int(a[0])
 m = int(a[1])
 d = int(a[2])

 if m == 2:
  if leapYear(year):
   print((29 - d) // 2 + 1)
  else:
   print((28 + 31 - d) // 2 + 1)

 if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
  print((31 - d) // 2 + 1)
 elif m == 4 or m == 6 or m == 9 or m == 11:
  print((30 + 31 - d) // 2 + 1)