; Calcule a*b^n mod m (defun exp-mod (a b n m) (if (= n 0) (mod a m) (if (evenp n) (exp-mod a (mod (* b b) m) (/ n 2) m) (exp-mod (mod (* a b) m) b (1- n) m)))) (format t "~d~%" (exp-mod 1 (/ (+ (read) (read)) 2) (read) 1000000007))