#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ans = 0;
    long long temp;
    while (temp > 0) {
      if (n < 10) {
        ans += n;
        break;
      }
      temp = n / 10;
      ans += temp * 10;
      long long temp1 = n - temp * 10;
      n = temp + temp1;
    }
    cout << ans << endl;
  }
}
