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;
unsigned long long int sq(unsigned long long int n) { return n * n; }
unsigned long long int binarypower(unsigned long long int m,
                                   unsigned long long int b) {
  if (b == 1) return m;
  return sq(binarypower(m, b - 1)) % 1000000007;
}
unsigned long long int power(unsigned long long int m,
                             unsigned long long int n) {
  unsigned long long int sum = 0;
  for (int i = 0; i < 32; ++i) {
    if (n & (1 << i)) {
      sum = (sum + binarypower(m, i + 1)) % 1000000007;
    }
  }
  return sum;
}
int main() {
  unsigned long long int m, n;
  cin >> m >> n;
  cout << power(m, n) << endl;
  return 0;
}
