#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long t;
  cin >> t;
  while (t--) {
    long n;
    cin >> n;
    long temp, cash_back, spend = 0, left = 0;
    if (n == 1) {
      cout << "1\n";
    } else {
      temp = n;
      while (n > 0) {
        left = temp % 10;
        temp = (temp / 10) * 10;
        cash_back = floor(temp / 10);
        spend += temp;
        temp = cash_back + left;
        n /= 10;
      }
      cout << spend + temp << "\n";
    }
  }
  return 0;
}
