#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  long long t;
  long long s;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    cin >> s;
    long long x = 0, y = 0, z = 0;
    x = s;
    for (long long j = 1; j > 0; j++) {
      y = s % 10;
      x = x / 10;
      z = x + y;
      s = s + x;
      x = z;
      if (x < 10) {
        j = -1;
      }
    }
    cout << s << endl;
  }
  return 0;
}
