local ffi = require("ffi") local C = ffi.C ffi.cdef[[ long long atoll(const char*); ]] local function lltonumber(str) return C.atoll(str) end local mod = 1000000007LL a, n = io.read():match("(%d+) (%d+)") a = lltonumber(a) n = lltonumber(n) local v = 1LL while 0LL < n do if n % 2LL == 1LL then v = (v * a) % mod end a = (a * a) % mod n = n / 2LL end print(1000000007) v = tostring(v):gsub("LL", "") print(v)