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