#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    unsigned long long n;
    unsigned long long total = 0;
    cin >> n;
    while (n >= 10) {
      unsigned long long num = n;
      while (num % 10 != 0) num--;
      if (num >= 10) {
        n = n - num;
        n = n + (num / 10);
        total = total + num;
      }
    }
    total = total + n;
    cout << total << endl;
  }
  return 0;
}
