#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long s;
    cin >> s;
    long long count = 0;
    long long rem, divv;
    while (s / 10) {
      rem = s % 10;
      count += s - rem;
      s /= 10;
      s += rem;
    }
    cout << count + s << "\n";
  }
  return 0;
}
