using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; public static class P { public static void Main() { int t = int.Parse(Console.ReadLine()); for (int i = 0; i < t; i++) { long n = int.Parse(Console.ReadLine()); while (n % 2 == 0) n /= 2; while (n % 5 == 0) n /= 5; int len = 0; BigInteger val = 0; do { while (val % 10 != 9) val += n; val /= 10; len++; } while (val != 0); Console.WriteLine(len); } } }