#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double eps = 1e-8;
const int INF32 = 0x3f3f3f3f;
const long long INF64 = 0x3f3f3f3f3f3f3f3f;
const int mod = 30 + 7;
const unsigned long long mod2 = 1;
const int N = 2e3 + 5;
const int sz = (1 << 20);
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long ans = 0;
    while (n >= 10) {
      ans += n - n % 10;
      n = n / 10 + n % 10;
    }
    ans += n;
    cout << ans << '\n';
  }
  return 0;
}
