#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a,b) memset((a),(b),sizeof(a)) const LL INF = 1e9 + 7; const int N = 1e5 + 10; const LL mod = INF; LL powmod(LL a, LL b) { LL ret = 1; while (b) { if (b & 1) ret = ret * a % mod; b >>= 1; a = a * a % mod; } return ret; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); LL a, n; cin >> a >> n; cout << mod << endl; cout << powmod(a, n) << endl; return 0; }