System.in.splitEachLine(' '){a,b->Eval.me"println(($a%10)**($b%4+4)%10)"}