For given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.

Constraints

* 1 ≤ m ≤ 100
* 1 ≤ n ≤ 109

Input


m n


Two integers m and n are given in a line.

Output

Print mn (mod 1,000,000,007) in a line.

Examples

Input

2 3


Output

8


Input

5 8


Output

390625
public class Main{
  static long mod = 1000000007;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    long m, n;

    m = sc.nextInt();
    n = sc.nextInt();
    System.out.println(power(m, n));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static long power(long m, long n){
    long q, r;

    if(n == 1)return m;
    else{
      q = n / 2;
      r = n % 2;
      return (power(((m * m) % mod), q) + m * r) % mod;
    }

  }
}