Pagini recente » Cod sursa (job #1001697) | Cod sursa (job #126702) | Cod sursa (job #101247) | Cod sursa (job #1114665) | 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.