#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, a = 0, b, x = 0, i, m = 1;
    cin >> n;
    b = n;
    while (n != 0) {
      b = n % 10;
      a += (n - b);
      n = n / 10;
      n += b;
      if (n < 10) {
        a += n;
        break;
      }
    }
    cout << a << endl;
  }
}
