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