#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int s = t;
  int ans[10001];
  while (t != 0) {
    int n;
    cin >> n;
    if (n < 10) {
      ans[t] = n;
    } else {
      int d = n;
      int x = 0;
      x = n / 10;
      int sum = n / 10;
      n = n % 10 + x;
      while (n >= 10) {
        x = n / 10;
        sum += n / 10;
        n = n % 10 + x;
      }
      ans[t] = d + sum;
    }
    t--;
  }
  for (int i = s; i >= 1; i--) {
    cout << ans[i] << endl;
  }
  return 0;
}
