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;
class timer {
  enum KIND { REAL, CPU };
  double t0;
  double t1;
  KIND kind_of_time;
  double get_realtime() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return tv.tv_sec + (double)tv.tv_usec * 1e-6;
  }
  double get_cputime() {
    struct rusage RU;
    getrusage(RUSAGE_SELF, &RU);
    return RU.ru_utime.tv_sec + (double)RU.ru_utime.tv_usec * 1e-6;
  }

 public:
  timer() { kind_of_time = REAL; }
  void set(KIND k) { kind_of_time = k; }
  void start() { t0 = get_realtime(); }
  void stop() { t1 = get_realtime(); }
  void print() { printf("TotalTime : %.3fsec\n", t1 - t0); }
};
long long int pow(long long int x, int n);
int rem(int x, int n, int mod);
int main() {
  timer T;
  int m, n;
  cin >> m >> n;
  long long int r;
  T.start();
  r = rem(m, n, 1000000007);
  T.stop();
  cout << r << endl;
  return 0;
}
int rem(int x, int n, int mod) {
  if (!n) return 1;
  long long res;
  res = pow(x * x, n / 2) % mod;
  if (n % 2) res = res * x % mod;
  return res % mod;
}
long long int pow(long long int x, int n) {
  if (!n) return 1;
  long long int res;
  res = pow(x * x, n / 2);
  if (n % 2) res *= x;
  return res;
}
