#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    long long res = 0;
    long long mod = 0;
    while (n) {
      res += n - n % 10;
      mod += n % 10;
      n = n / 10;
      if (n < 10) {
        n += mod;
        mod = 0;
        if (n < 10) {
          res += n;
          break;
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}
