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