#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  cin >> t;
  for (int z = 0; z < t; z++) {
    unsigned long long n, ans = 0;
    cin >> n;
    while (n >= 10) {
      ans = ans + n - (n % 10);
      n = (n % 10) + (n / 10);
    }
    cout << ans + n << endl;
  }
}
