#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef pair pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "< P; void solve(){ string s; cin>>s; while(s.size()>1){ string t; REP(i,s.size()-1){ char a = s[i]; char b = s[i+1]; int x = (a-'0')+(b-'0'); if(x>=10){ x -= 9; } t += (char)(x+'0'); } s=t; } cout<