Pagini recente » Cod sursa (job #1462880) | Cod sursa (job #1448779) | Cod sursa (job #171898) | Cod sursa (job #319208) | Cod sursa (job #1459073)
#include <iostream>
#include <fstream>
#define M 1999999973
using namespace std;
long power (long n, long p) {
long r = 1, temp = n, checkbit = 1;
while (checkbit <= p) {
if (checkbit & p) r = (r * temp) % M;
temp = (temp * temp) % M;
checkbit <<= 1;
}
return r;
}
int main (void) {
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
long n, p;
cin >> n >> p;
cout << power(n,p) % M;
return 0;
}