#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n;
    cin >> n;
    long long ans = n, k;
    while (n >= 10) {
      k = n / 10;
      n %= 10;
      n += k;
      ans += k;
    }
    cout << ans << endl;
  }
}
