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