#include <bits/stdc++.h>
using namespace std;
void solve() {
  int t;
  cin >> t;
  while (t--) {
    long long s, num, ans = 0;
    cin >> s;
    num = s;
    while (num >= 10) {
      long long num1 = (num / 10);
      num -= num1 * 10;
      ans += num1 * 10;
      num += num1;
    }
    ans += num;
    cout << ans << "\n";
  }
}
int main() { solve(); }
