(define (System.out.println x) (begin (display x) (newline) ) ) (let ( (N (modulo (read) 10)) (M (read)) ) (if (= M 0) (System.out.println 1) (let ( (foo (modulo M 12)) ) (if (= foo 0) (System.out.println (modulo (expt N 4) 10)) (System.out.println (modulo (expt N M) 10)) ) ) ) )