include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int call(string s)
{
if(s.size()==1) return stoi(s);
else
{
long long d=0;
for(char c:s)
{
d+=c-‘0’;
}
return call(to_string(d));
}
}
int main()
{
string s;
cin>>s;
int x=call(s);
cout<<x;
}