13406 - 数根

include<bits/stdc++.h>

using namespace std; int main(){

int n,t,s;
cin>>n;
while(n>10){
	t=n;
	s=0;
	while(t!=0){
		s+=t%10;
		t/=10;
	}
	n=s;
}
cout<<n;
return 0;

}