Pagini recente » Cod sursa (job #1362250) | Cod sursa (job #1405469) | Cod sursa (job #1351893) | Cod sursa (job #2972767) | Cod sursa (job #1380222)
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fs first
#define sc second
#define pob pop_back
#define pub push_back
#define eps 1E-7
#define sz(a) a.size()
#define count_one __builtin_popcount;
#define count_onell __builtin_popcountll;
#define fastIO ios_base::sync_with_stdio(false)
#define PI (acos(-1.0))
#define linf (1LL<<62)//>4e18
#define inf (0x7f7f7f7f)//>2e9
#define DEBUG 1
#ifdef DEBUG
#define D(x) x
#else
#define D(x)
#endif
#define MOD 1999999973
FILE *in = fopen("lgput.in", "r");
FILE *out = fopen("lgput.out", "w");
long long lgput(long long x, long long p) {
long long res = 1;
x %= MOD;
while(p) {
if(p % 2) {
res = (res * x) % MOD;
}
p >>= 1;
x = (x*x)%MOD;
}
return res;
}
long long lgput2(long long x, long long p) {
long long sol = 1, a = x;
for(int i = 0; (1 << i) <= p; ++i) {
if( ((1 << i) & p) > 0 )
sol = (sol * a) % MOD;
a = (a * a) % MOD;
}
return sol;
}
int main()
{
long long n, p;
fscanf(in, "%lld%lld", &n, &p);
fprintf(out, "%lld\n", lgput2(n, p));
return 0;
}