#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int ttt;
  cin >> ttt;
  for (long long int iq = 0; iq < ttt; ++iq) {
    long long int n, e = 0;
    cin >> n;
    long long int s = n % 10;
    while (n >= 10) {
      n = n / 10;
      n = n * 10;
      e += n;
      n = n / 10;
      n += s;
      s = n % 10;
    }
    cout << e + s << endl;
  }
  return 0;
}
