#include<bits/stdc++.h> using namespace std; int main() { int n,sum=0; cin>>n; while(cin>>n){ sum=0; while(n){ sum+=sum*10+sum%10; } cout<<sum<<endl; } }