import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String s1=sc.next(); String s2=sc.next(); int n=s1.charAt(s1.length()-1)-'0'; int m=0; if(s2.length()<3) m=Integer.valueOf(s2); else m=Integer.valueOf(s2.substring(s2.length()-2,s2.length())); m%=4; int ans=n; for(int i=1;i