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;
int power1(int a, int b) {
  long long number = 1;
  for (int i = 1; i <= b; i++) {
    number *= a;
    number %= 1000000007;
  }
  return (int)number;
}
int power2(int a, int b) {
  long long number = 1;
  for (int i = 1; i <= 30; i++) {
    long long number_ = 1;
    if ((b / power1(2, i)) % 2 == 1) {
      number_ = a;
      for (int j = 1; j <= i; j++) {
        number_ *= number_;
        number_ %= 1000000007;
      }
    }
    number *= number_;
    number %= 1000000007;
  }
  return (int)number;
}
int main() {
  int m, n;
  cin >> m >> n;
  cout << power2(m, n) << endl;
  return 0;
}
