File standardInput readLines map(split map(asNumber)do(writeln(list(pop,y:=if(3>m:=pop,m=m+12;-1,0)+pop,y>>2,-y/100|0,y/400|0,m*2.6+1.6|0)sum%7)))