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