package codechef;
import java.util.Scanner;
public class ans {
public static int help(int n) {
int ans=0;
int a=n;
int d=0;
int ten=1;
while(a!=0) {
d++;
ten=ten10;
a=a/10;
}
int div=ten/10;
int mod=10000007;
for(int i=0;i<d;i++) {
ans+=n;
//ans%=mod;
/int add=n/10;
n=n%10;
n=ndiv+add;/
int rem=n%div;
n=n/div;
n=rem*10+n;
if(i!=d-1) {
ans*=ten;
}
}
return ans;
}
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int i=0;i<t;i++) {
int n=s.nextInt();
System.out.println(help(n));
}
}
}