#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int t;
  cin >> t;
  while (t--) {
    ll s;
    cin >> s;
    ll ans = 0;
    ll k = 10;
    ll rem = 0;
    while (s >= 10) {
      ll p = s % 10;
      s -= p;
      rem = p;
      ans += s;
      rem += s / 10;
      s = rem;
    }
    ans += s;
    cout << ans << endl;
  }
  return 0;
}
