Hello 2018
G
Power Substring
Codeforces
3200
原题
← FH →
翻译中…

You are given $*n*$ positive integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$.

翻译中…

For every $*a*_{*i*}$ you need to find a positive integer $*k*_{*i*}$ such that the decimal notation of $2^{*k*_{*i*}}$ contains the decimal notation of $*a*_{*i*}$ as a substring among its last $*min*(100, *length*(2^{*k*_{*i*}}))$ digits. Here $*length*(*m*)$ is the length of the decimal notation of $*m*$.

翻译中…

Note that you don't have to minimize $*k*_{*i*}$. The decimal notations in this problem do not contain leading zeros.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($1 ≤ *n* ≤ 2 000$) — the number of integers $*a*_{*i*}$.

翻译中…

Each of the next $*n*$ lines contains a positive integer $*a*_{*i*}$ ($1 ≤ *a*_{*i*} < 10^{11}$).

翻译中…

Output

翻译中…

Print $*n*$ lines. The $*i*$-th of them should contain a positive integer $*k*_{*i*}$ such that the last $*min*(100, *length*(2^{*k*_{*i*}}))$ digits of $2^{*k*_{*i*}}$ contain the decimal notation of $*a*_{*i*}$ as a substring. Integers $*k*_{*i*}$ must satisfy $1 ≤ *k*_{*i*} ≤ 10^{50}$.

翻译中…

It can be shown that the answer always exists under the given constraints. If there are multiple answers, print any of them.

翻译中…

样例

Input #1
2
8
2
Output #1
3
1
InputCopy OutputCopy
Input #2
2
3
4857
Output #2
5
20
InputCopy OutputCopy
题目信息
题号
913G
所属比赛
时间限制
2 s
内存限制
256 MB
标签
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。