#include <bits/stdc++.h>
using namespace std;
long long mod = (long long)(1e9 + 7);
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1 == 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return (ans + mod) % mod;
}
void solve() {
  int t;
  cin >> t;
  int ans = 0;
  while (t / 10 > 0) {
    ans += t - t % 10;
    t = t % 10 + t / 10;
  }
  ans += t;
  cout << ans << endl;
}
signed main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
