#include #include #define rep(i,n) for (int i = 0; i < (n); ++i) #define ll long long #define mod 1000000007 using namespace std; int main(){ int a; cin>>a; int ans=0; rep(i,99){ ans=0; while(a>0){ ans+=a%10; a=a/10; } a=ans; } cout<