#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream #include //gcd, assumlate #include //randam_device #include //numeric_limits #include //tm using namespace std; constexpr int64_t D_MOD = 1000000007; inline int64_t ModExp(int64_t b, int64_t e, int64_t m) { //bのe乗をmで割った余り int64_t ans = 1; while (e > 0) { if ((e & 1) == 1) { ans = (ans * b) % m; } e >>= 1; b = (b * b) % m; } return ans; } int main() { int64_t a, n; cin >> a >> n; int64_t ans = ModExp(a, n, D_MOD); cout << D_MOD << endl; cout << ans << endl; return 0; }