Pagini recente » Cod sursa (job #1248171) | Cod sursa (job #1174886) | Cod sursa (job #2633993) | Cod sursa (job #2706793) | Cod sursa (job #146284)
Cod sursa(job #146284)
var fi,fo:text;
n,p,m:int64;
function exp(p:int64):int64;
var aux:int64;
begin
if p=1 then exp:=n
else
begin
aux:=exp(p shr 1);
if p and 1=0 then exp:=(aux mod m)*(aux mod m) mod m
else exp:=(aux mod m)*(aux mod m)*n mod m;
end;
end;
begin
assign(fi,'lgput.in'); reset(fi);
assign(fo,'lgput.out'); rewrite(fo);
read(fi,n,p);
m:=1999999973;
n:=n mod m;
writeln(fo,exp(p));
close(fi);
close(fo);
end.