Pagini recente » Cod sursa (job #72739) | Cod sursa (job #2192455) | Cod sursa (job #1476289) | Cod sursa (job #1234160) | Cod sursa (job #156188)
Cod sursa(job #156188)
const x=1999999973;
var n,p:int64;
g:text;
procedure citire;
var f:text;
begin assign(f,'lgput.in'); reset(f);
read(f,n,p);
close(f);
end;
function pow(n,p:int64):int64;
begin
if p=0 then pow:=1
else if odd(p) then pow:=(n*(pow(sqr(n)mod x,(p-1)shr 1))mod x)mod x
else pow:=(pow(sqr(n)mod x,p shr 1))mod x;
end;
begin {pp}
citire;
assign(g,'lgput.out');rewrite(g);
n:=n mod x;
write(g,pow(n,p)mod x);
close(g);
end.