#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int s;
    cin >> s;
    long long int total = 0;
    while (s > 9) {
      total += s - (s % 10);
      s = s / 10 + s % 10;
    }
    cout << total + s << endl;
  }
  return 0;
}
