#include <bits/stdc++.h>
using namespace std;
long long r, er[2000100], ar[2000010], n, m, z, cr, ans, a, ans1, ans2, ans3, b,
    c, d, e, chan0, chan1, le0, le1, chan, le, t, z1, z2, nb, gr[2000010],
    f[2000010], mn1, mn2, k, l, ans4, ans5, ans6;
char ch, ch1;
string s;
char s1[200010];
bool tf;
map<long long, long long> Map;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    ans = 0;
    while (n >= 10) {
      a = n / 10;
      ans1 = a * 10;
      n -= ans1;
      n += a;
      ans += ans1;
    }
    cout << ans + n << '\n';
  }
}
