#include int main() { int Test; scanf("%d", &Test); while (Test--){ char S[1010]; scanf ("%s",S); int l = 0; while (S[l]) l++; for (int i=l;i>=2;i--){ for (int j=0;j= 10) u -= 9; S[j] = u + '0'; } } putchar(S[0]); puts(""); } return 0; }