#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
const int inf = INT_MAX >> 1;
int T;
void solve() { scanf("%d", &T); }
int main() {
  solve();
  while (T--) {
    long long int n;
    long long int ans = 0;
    scanf("%lld", &n);
    while (n >= 10) {
      long long int t1 = n / 10 * 10;
      ans += t1;
      int tmp = n / 10;
      n = n % 10;
      int kljkldfs;
      n = n + tmp;
    }
    printf("%d\n", ans + n);
  }
  return 0;
}
