#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int s;
    cin >> s;
    long long int x, y, val, val1;
    x = s;
    val = s;
    while (x >= 10) {
      y = x / 10;
      val1 = x % 10;
      x = y + val1;
      val += y;
    }
    cout << val << '\n';
  }
  return 0;
}
