#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 10;
const long long mod = 998244353;
inline int madd(int x, int y) { return (x + y) % mod; }
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool isSub(char str1[], char str2[], int m, int n) {
  int j = 0;
  for (int i = 0; i < n && j < m; i++)
    if (str1[j] == str2[i]) j++;
  return (j == m);
}
const int maxn = 100005;
int a[maxn];
int b[maxn];
long long dp[maxn][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  cin >> t;
  while (t--) {
    long long n, c = 0, p = 0;
    cin >> n;
    long long ans = 0;
    while (n >= 10) {
      ans += (n - n % 10);
      n = n % 10 + n / 10;
    }
    cout << ans + n << endl;
  }
}
