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