#include <bits/stdc++.h>
using namespace std;
int main() {
  long t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long ctr = n;
    while (n / 10 > 0) {
      int x = n / 10;
      int r = n % 10;
      n = x + r;
      ctr += x;
    }
    cout << ctr << endl;
  }
}
