Pagini recente » Diferente pentru home intre reviziile 382 si 381 | Diferente pentru home intre reviziile 215 si 214 | Rating Alex Pacurariu (bloomberg) | Diferente pentru home intre reviziile 615 si 614 | Cod sursa (job #220141)
Cod sursa(job #220141)
var P,N,Z,p5,cn:longint;
begin
assign(input,'fact.in'); reset(input);
assign(output,'fact.out'); rewrite(output);
readln(p);
if p=0 then writeln(1)
else begin
n:=4*P; n:=n-n mod 5;
z:=0; p5:=5;
while n>=p5 do begin
z:=z+n div p5;
p5:=p5*5;
end;
while z<p do begin
inc(n,5); cn:=n;
while cn mod 5=0 do begin inc(z); cn:=cn div 5;end;
end;
if z=p then writeln(n)
else writeln(-1);
end;
close(input); close(output);
end.