{"problem":{"name":"222","description":{"content":"We have a sequence $2,22,222,2222,\\ldots$, where the $i$\\-th term is an $i$\\-digit integer whose digits are all $2$. Where does a multiple of $K$ appear in this sequence for the first time? If the fir","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc222_g"},"statements":[{"statement_type":"Markdown","content":"We have a sequence $2,22,222,2222,\\ldots$, where the $i$\\-th term is an $i$\\-digit integer whose digits are all $2$.\nWhere does a multiple of $K$ appear in this sequence for the first time? If the first multiple of $K$ is the $x$\\-th term of the sequence, print $x$; if there is no multiple of $K$, print `-1`.\nGiven $T$ cases, solve each of them.\n\n## Constraints\n\n*   $1 \\leq T \\leq 200$\n*   $1 \\leq K \\leq 10^8$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\text{case}_2$\n$\\vdots$\n$\\text{case}_T$\n\nEach case is in the following format:\n\n$K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc222_g","tags":[],"sample_group":[["4\n1\n7\n10\n999983","1\n6\n-1\n999982\n\nWe have four cases.\n\n*   $2$ is a multiple of $1$.\n*   None of $2,22,222,2222,22222$ is a multiple of $7$, but $222222$ is.\n*   None of $2,22,\\ldots$ is a multiple of $10$."]],"created_at":"2026-03-03 11:01:13"}}