#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mex = 100005;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int x, sum = 0;
    cin >> x;
    while (x >= 10) {
      sum += (x / 10) * 10;
      x = x / 10 + x % 10;
    }
    cout << sum + x << endl;
  }
}
