#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; for(int i=0;i> S; while(S.size() != 1){ string temp; rep(i,S.size() - 1){ int n = S[i] - '0' + S[i + 1] - '0'; int l; if(n >= 10) l = n / 10 + n % 10; else l = n; temp += to_string(l); } S = temp; } cout << S << endl; } return 0; }