#include <bits/stdc++.h>
using namespace std;
int spend(int x) {
  int b, total, cash_back, left;
  cash_back = x / 10;
  b = cash_back * 10;
  left = x - b + cash_back;
  if (cash_back < 1) {
    return left;
  }
  return b + spend(left);
}
int main() {
  int testcase;
  cin >> testcase;
  int burles[testcase];
  for (int i = 0; i < testcase; ++i) {
    cin >> burles[i];
    cout << spend(burles[i]);
    cout << endl;
  }
  return 0;
}
