import java.io.*; class test{ public static void main(String[]x)throws Exception{ BufferedReader i=new BufferedReader(new InputStreamReader(System.in)); for(String s=i.readLine();s!=null;s=i.readLine()){ String[] t=s.split(" "); int y=Integer.valueOf(t[0]); int m=Integer.valueOf(t[1]); int d=Integer.valueOf(t[2]); if(m<3){y--;m+=12;} System.out.println((y+y/4-y/100+y/400+(26*m+16)/10+d)%7); } } }
Note that non-ascii characters in the above source code will be escaped (such as \x9f).