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