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