// raise a to n-th power and modulo MOD package main import ( "fmt" ) const MOD = 1000000007 func main() { var a, n int fmt.Scan(&a, &n) fmt.Println(pow(a, n)) } func pow(a, n int) int { if n == 0 { return 1 } if n%2 == 0 { return pow(a*a%MOD, n/2) } return a * pow(a, n-1) % MOD }