#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int r = 0; r < t; r++) {
    long long int n;
    cin >> n;
    long long int sum = 0;
    while (n >= 10) {
      if (n % 10 != 0) {
        sum = sum + (n / 10) * 10;
        n = (n % 10) + (n / 10);
      } else {
        sum = sum + n;
        n = n / 10;
      }
    }
    cout << sum + n << endl;
  }
}
