#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int s, x = 0, y = 0, count;
  int q;
  cin >> q;
  while (q--) {
    count = 0;
    cin >> s;
    while (s) {
      count += (s - (s % 10));
      x = s / 10;
      s = s % 10;
      s += x;
      if (s < 10) {
        count += s;
        break;
      }
    }
    cout << count << endl;
  }
  return 0;
}
