#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int s;
    scanf("%d", &s);
    long long cnt = 0;
    while (s >= 10) {
      int lft = s % 10;
      cnt += (s - lft);
      s = s / 10 + lft;
    }
    cnt += s;
    printf("%lld\n", cnt);
  }
  return 0;
}
