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