character*999c;integer*8n;1 read*,c,n;print'(i0)',mod((ichar(c(len_trim(c):))-48)**(mod(n-1,4)+1),10);goto1;end