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
#include <bits/stdc++.h>
using namespace std;
long long fact[200005];
long long extgcd(long long a, long long b, long long& x, long long& y) {
  long long d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}
long long mod_inverse(long long a, long long m) {
  long long x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}
long long euler_phi(long long n) {
  long long res = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      res = res / i * (i - 1);
      for (; n % i == 0; n /= i)
        ;
    }
  }
  if (n != 1) res = res / n * (n - 1);
  return res;
}
long long euler[100000];
void euler_phi2() {
  for (long long i = 0; i < 100000; i++) euler[i] = i;
  for (long long i = 2; i < 100000; i++) {
    if (euler[i] == i) {
      for (long long j = i; j < 100000; j += i)
        euler[j] = euler[j] / i * (i - 1);
    }
  }
}
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
void init(long long p) {
  fact[0] = 1;
  for (long long i = 1; i < 200005; i++) fact[i] = (fact[i - 1] * i) % p;
}
long long mod_fact(long long n, long long p, long long& e) {
  e = 0;
  if (n == 0) return 1;
  long long res = mod_fact(n / p, p, e);
  e += n / p;
  if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
  return res * fact[n % p] % p;
}
long long mod_comb(long long n, long long k, long long p) {
  if (n == k || k == 0) return 1;
  long long e1, e2, e3;
  long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2),
            a3 = mod_fact(n - k, p, e3);
  if (e1 > e2 + e3) return 0;
  return a1 * mod_inverse(a2 * a3 % p, p) % p;
}
signed main() {
  long long n, m;
  cin >> n >> m;
  cout << mod_pow(m, n, 1000000007) << endl;
  ;
  return 0;
}
