Pagini recente » Cod sursa (job #1355756) | Cod sursa (job #46014) | Cod sursa (job #2060424) | Cod sursa (job #1026724) | Cod sursa (job #938382)
Cod sursa(job #938382)
var n,m,s,p :longint;
begin
assign(input,'fact.in');
assign(output,'fact.out');
reset(input);
rewrite(output);
readln(p);
n:=p*4;
repeat
m:=5; s:=0;
while m<=n do begin
s:=s+(n div m) ;
m:=m*5;
end;
inc(n);
until (s=p) or (s>p);
if p=0 then write('1')
else if s=p then write(n-1)
else write('-1');
close(input);
close(output);
end.