#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double pi = acos(-1);
const int maxn = 1e6 + 10;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    long long sum = n;
    while (n >= 10) {
      sum += n / 10;
      int k = n / 10;
      n = n % 10 + k;
    }
    printf("%lld\n", sum);
  }
  return 0;
}
