#include <bits/stdc++.h>
using namespace std;

long long m, n, p[31], ans=1;

int main() {
    cin >> m >> n;
    p[0] = m;
    for (int i=1; i<31; i++) {
        p[i] = (p[i-1]*p[i-1])%1000000007;
    }
    for (int i=0; i<31; i++) {
        if (n%2==1) ans=ans*p[i];
        n/=2;
        ans = ans%1000000007;
    }
    cout << ans << endl;
}

### Prompt

In cpp, your task is to solve the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

long long m, n, p[31], ans=1;

int main() {
    cin >> m >> n;
    p[0] = m;
    for (int i=1; i<31; i++) {
        p[i] = (p[i-1]*p[i-1])%1000000007;
    }
    for (int i=0; i<31; i++) {
        if (n%2==1) ans=ans*p[i];
        n/=2;
        ans = ans%1000000007;
    }
    cout << ans << endl;
}

```