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