Pagini recente » Cod sursa (job #434239) | Cod sursa (job #2812595) | Cod sursa (job #827055) | Cod sursa (job #2169432) | Cod sursa (job #51749)
Cod sursa(job #51749)
var n:longint;
x5:longint;
i:integer;
function power(x:integer):integer;
var rez:integer;
begin
rez:=0;
while x mod 5 = 0 do
begin
inc(rez);
x:=x div 5;
end;
power:=rez;
end;
begin
assign(input,'fact.in');
reset(input);
assign(output,'fact.out');
rewrite(output);
readln(n);
x5:=0;
i:=1;
while x5<n do
begin
inc(x5,power(i));
inc(i);
end;
if n<0 then writeln('-1') else if i=1 then writeln('1') else if (i-1) mod 10 = 0 then writeln(i-1) else writeln('-1');
close(output);
end.