#include <bits/stdc++.h>
using namespace std;
void solve() {
  int s;
  cin >> s;
  int count = 0;
  for (; s >= 10;) {
    int x = 10 * (s / 10);
    s -= x;
    count += x;
    s += x / 10;
  }
  count += s;
  cout << count << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return EXIT_SUCCESS;
}
