Pagini recente » Cod sursa (job #2044283) | Cod sursa (job #1480766) | Cod sursa (job #1966972) | Cod sursa (job #2809983) | Cod sursa (job #731152)
Cod sursa(job #731152)
var n,p:int64;
f,h:text;
Function rest(q:int64):int64;
var t:int64;
begin
if q=1 then rest:=(n mod 1999999973) else
if odd(q) then rest:=((rest(q-1)*n) mod 1999999973)
else begin
t:=rest(q div 2) mod 1999999973;
t:=t*t;
rest:=t mod 1999999973;
end;
end;
begin
assign(f,'lgput.in');
reset(f);
read(f,n);
readln(f,p);
assign(h,'lgput.out');
rewrite(h);
writeln(h,rest(p));
close(f);
close(h);
end.