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>
int main() {
  uint64_t m, n, r, q, p, m2;
  uint64_t i;
  struct C {
    uint64_t m;
    uint64_t di;
    C(uint64_t m, uint64_t di) {
      C::m = m;
      C::di = di;
    }
  };
  std::stack<C> sC;
  q = 1000000007;
  std::cin >> m >> n;
  sC.push(C(m, 1));
  r = 1;
  i = 0;
  while (sC.size() != 0) {
    uint64_t tm = sC.top().m;
    uint64_t di = sC.top().di;
    if (i + di > n) {
      sC.pop();
      continue;
    }
    r *= tm;
    r = r % q;
    i += di;
    sC.push(C(tm * tm, di * 2));
  }
  std::cout << r << "\n";
  return 0;
}
