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