Pagini recente » Cod sursa (job #2636250) | Cod sursa (job #2604304) | Cod sursa (job #1869338) | Cod sursa (job #2502503) | Cod sursa (job #1116305)
Program logn;
var n,p: longint;
function putere(baza,exp : longint) : longint;
var aux : longint; 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:=p;
end;
end;
begin
assign(input,'lgput.in'); reset(input);
assign(output,'lgput.out'); rewrite(output);
readln(n,p);
writeln(putere(n,p));
close(input); close(output);
end.