#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = (ll)(1e9 + 7);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t = 1;
  cin >> t;
  while (t--) {
    ll n;
    cin >> n;
    ll ans = 0;
    ll after_spend = n;
    while (n > 9) {
      ll rem = n % 10;
      ans += n - rem;
      after_spend = n / 10 + rem;
      n = after_spend;
    }
    cout << ans + n << "\n";
  }
  return 0;
}
