#include<iostream>
using namespace std;
int main()
{
int len,j=0,i,t;
cin>>len;
int*p=new int[len];
int*h=new int[len];
for(i=0;i<len;i++)
{
cin>>p[i];
h[i]=p[i];
}
for(i=0;i<len;i++)
{
while(p[i]>=10)
{
++j;
p[i]=p[i]/10;
}
for(t=0;t<j;t++)
{
p[i]=p[i]*10;
}
cout<<h[i]-p[i]<<endl;
j=0;
}
return 0;
}