var r, n, k: integer;
begin
repeat
write('n > 0; n = ');
readln(n)
until n > 0;
while n mod 2 = 0 do n := n div 2; //или while n and 1 = 0 do n := n shr 1;
while n mod 5 = 0 do n := n div 5;
k := 0;
r := 1;
repeat
inc(k);
r := r * 10 mod n
until r <= 1;
writeln(k);
readln
end.
begin
repeat
write('n > 0; n = ');
readln(n)
until n > 0;
while n mod 2 = 0 do n := n div 2; //или while n and 1 = 0 do n := n shr 1;
while n mod 5 = 0 do n := n div 5;
k := 0;
r := 1;
repeat
inc(k);
r := r * 10 mod n
until r <= 1;
writeln(k);
readln
end.