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