#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { unsigned long long t, a, b, j; string n; cin >> t; for (ll i = 0; i < t; i++) { cin >> n; j = stoll(n); while (j < 1e18){ a = stoll(n) + j; b = stoll(n)*pow(10, to_string(j).size()) + stoll(n); if (!(b%a)){ cout << j << endl; break; } else j += stoll(n); } } }