Square
题号:NC254989
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Find a number 0 \leq y\leq 10^9 so that the square of y starts with x in Decimal.
Formally, given a integer x, find an integer y(0 \leq y\leq 10^9) such that there exists a nonnegative integer k that satisfies \lfloor \frac{y^2}{10^k} \rfloor = x.

输入描述:

Each test contains multiple test cases. The first line of input contains a single integer t(1\le t\le 10^5) --- the number of test cases.

Each test case contains an integer x(0\leq x\leq 10^9) - the x described in the problem statement.

输出描述:

For each test case, output an integer y(0\leq y\leq 10^9).If there are multiple results, you can output any one. If no y satisfies the condition, output `-1'.
示例1

输入

复制
3
1
123
781273981

输出

复制
4
111
-1