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