#include <bits/stdc++.h>
using namespace std;
long long solve(long long x) {
  if (x < 10) return x;
  long long int k = x / 10;
  return 10 * k + solve(k + x % 10);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a;
    cin >> a;
    cout << solve(a) << endl;
  }
  return 0;
}
