#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = 0, a = 0;
    while (n > 9) {
      a = n % 10;
      ans += n - a;
      n = n / 10 + a;
    }
    ans = (int)ans;
    cout << ans + n << endl;
  }
}
