[ACM]Q10127: Ones
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
namespace Q10127
{
class Program
{
static private char[] par = { '1' }; static private BigInteger _n, sum; static private bool tof;
static void Main(string[] args)
{
while (true)
{
label: Console.Write("N>>>");
tof = BigInteger.TryParse(Console.ReadLine(), out _n);
if (!tof||_n%2==0||_n%5==0) goto label;
sum = 1;
for (BigInteger i = 1; ; i+=2)
{
if (i % 5==0) continue;
sum = _n * i;
if (sum.ToString().Split(par, StringSplitOptions.RemoveEmptyEntries).Length == 0)
{ Console.WriteLine(sum.ToString().Length); break; }
}
}
}
}
}