Pagini recente » Monitorul de evaluare | Cod sursa (job #1292714) | Statistici Mihai Andei (bIzAr) | Monitorul de evaluare | Cod sursa (job #1517943)
#include <stdio.h>
#include <fstream>
#define DIVISOR 1999999973
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
long long LgPut(long long N, long long P){
if (P < 0) return LgPut(1/N, -P);
if(P == 1) return N;
if(P % 2 == 0) return LgPut(N*N, P/2);
if(P % 2 == 1) return N*LgPut(N*N, (P-1)/2);
}
int main(){
long long N, P;
in >> N >> P;
out << LgPut(N, P)%DIVISOR << "\n";
return 0;
}