#include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i>t; string s; rep(tn,t){ cin>>s; int n=s.length(); int a[n]; int nx=n; rep(i,n) a[i]=s[i]-'0'; while(nx>1){ rep(j,nx-1){ if(a[j]+a[j+1]<=9){ a[j]=a[j]+a[j+1]; } else{ a[j]=a[j]+a[j+1]-9; } } nx--; //cout<