Pagini recente » Cod sursa (job #2330016) | Cod sursa (job #1007561) | Cod sursa (job #2611676) | Cod sursa (job #1710601) | Cod sursa (job #941202)
Cod sursa(job #941202)
var s, m, n, i, j: longint;
u: boolean;
begin
assign(input,'fact.in');
reset(input);
assign(output,'fact.out');
rewrite(output);
readln(m);
n:=m*4+1;
u:=false;
j:=0;
repeat
inc(j);
i:=1;
s:=0;
repeat
i:=i*5;
s:=s+(n div i);
until (n div i)=0;
if s=m then u:=true
else inc(n);
if j=6 then Begin n:=-1; u:=true; end;
until u;
writeln(n);
close(input);
close(output);
end.