#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    long long int n, ans = 0;
    cin >> n;
    while (n >= 10) {
      ans += (n / 10) * 10;
      n = n % 10 + n / 10;
    }
    cout << ans + n << "\n";
  }
  return 0;
}
