Pagini recente » Cod sursa (job #1136917) | Cod sursa (job #3138578) | Cod sursa (job #2383289) | Cod sursa (job #3251973) | Cod sursa (job #1116776)
Program logn;
var n,p: int64;
function putere(baza,exp : int64) : int64;
var aux : int64; rest: int64;
begin
if exp=0 then putere:=1
else begin
aux:=1; rest:=1999999973;
while exp>0 do
begin
if exp mod 2=1 then aux:=(aux*baza) mod rest;
baza:=sqr(baza) mod rest;
exp:=exp div 2;
end;
putere:=aux;
end;
end;
begin
assign(input,'lgput.in'); reset(input);
assign(output,'lgput.out'); rewrite(output);
readln(n,p);
writeln(putere(n,p) mod 1999999973);
close(input); close(output);
end.