#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, s, cb, tot;
  cin >> t;
  while (t--) {
    cin >> s;
    tot = s;
    while (s >= 10) {
      cb = s / 10;
      tot += cb;
      s = s % 10 + cb;
    }
    cout << tot << endl;
  }
  return 0;
}
