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