Pagini recente » Cod sursa (job #3176750) | Cod sursa (job #2095305) | Cod sursa (job #531876) | Cod sursa (job #1734570) | Cod sursa (job #361283)
Cod sursa(job #361283)
Program ex;
var n,m,y,p : int64;
f,g : text;
Function exp(x,n : int64) : int64;
begin
if n=0 then exp:=1 else
if n mod 2=0 then
begin
y:=exp(x,n div 2) mod m;
exp:=y*y mod m;
end
else
exp:=((x mod m)*exp(x,n-1) mod m) mod m;
end;
begin
assign(f,'lgput.in'); assign(g,'lgput.out');
reset(f); rewrite(g);
readln(f,n,p);
m:=1999999973;
writeln(g,exp(n,p));
close(f);
close(g);
end.