#include <bits/stdc++.h>
using namespace std;
int ss[2123];
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long s, ss;
    ss = 0;
    cin >> s;
    while (s > 9) {
      ss += s - s % 10;
      s = s % 10 + s / 10;
    }
    ss += s;
    cout << ss << endl;
  }
  return 0;
}
