Pagini recente » Profil LifeArgent | Cod sursa (job #2754447) | Cod sursa (job #1242095) | Cod sursa (job #596776) | Cod sursa (job #203927)
Cod sursa(job #203927)
program p_006;{factorial}
var p,i,n,t:longint;
begin
assign(input,'fact.in'); reset(input);
assign(output,'fact.out'); rewrite(output);
readln(p);
i:=0;
if p=0 then write('1') else begin
n:=5;
while i<p do begin
if n mod 25=0 then begin
case n of
25, 50, 75, 100, 150, 200, 300, 350, 400, 450: i:=i+2;
125, 250, 500: i:=i+3;
625: i:=i+4;
3125: i:=i+5;
else
t:=n div 25; i:=i+2;
while t mod 5=0 do begin t:=t div 5; i:=i+1; end;
end;
i:=i-1;
end;
n:=n+5; i:=i+1;
end;
if i=p then write(n-5) else write('-1');
end;
close(input); close(output);
end.