#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i, j, c, b;
  cin >> t;
  while (t--) {
    c = 0;
    cin >> n;
    c = n;
    for (;;) {
      b = n % 10;
      n = n / 10;
      c = c + n;
      n = b + n;
      if (n < 10) break;
    }
    cout << c << endl;
  }
  return 0;
}
