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 power(int x, int y) {
  int retn = 1;
  for (int i = 0; i < y; ++i) {
    retn *= x;
  }
  return retn;
}
int main() {
  int m, n;
  cin >> m >> n;
  const long long mod = 1000000007;
  long long rem = m;
  int cnt = 0;
  for (int i = 30; i > 0; --i) {
    if (n / power(2, i) != 0) {
      ++cnt;
      if (cnt == 1) {
        rem = (rem * rem) % mod;
        n -= power(2, i);
      } else {
        rem = (m * rem) % mod;
        rem = (rem * rem) % mod;
      }
    } else {
      if (cnt) {
        rem = (rem * rem) % mod;
      }
    }
    cout << rem << " " << n << " " << i << "\n";
  }
  if (n == 1) {
    rem = (m * rem) % mod;
  } else if (n == 0) {
    cout << rem << "\n";
  }
}
