#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
  int orign = n;
  int holder = 0;
  int buy = 0;
  while (n > 0) {
    holder = n % 10;
    n -= holder;
    buy += n / 10;
    n /= 10;
    if (n <= 0) break;
    n += holder;
  }
  cout << orign + buy << endl;
}
int main() {
  int T, n;
  cin >> T;
  for (int i = 0; i < T; i++) {
    cin >> n;
    solve(n);
  }
  return 0;
}
