#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100000000000;
long long Ceil(long long a, long long b) { return (a / b) + ((a % b) != 0); }
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long cb = 0, rem = 0, total = 0;
    while (n / 10 > 0) {
      cb = n / 10;
      rem = n % 10;
      total += cb * 10;
      n = cb + rem;
    }
    cout << total + (n % 10) << endl;
  }
}
