#include using namespace std; using ch = char; using ll = long long; using ld = long double; using db = double; using st = string; using vdb = vector; using vvdb = vector; using vl = vector; using vvl = vector; using vvvl = vector; using vd = vector; using vvd = vector; using vs = vector; using vvs = vector; using vc = vector; using vvc = vector; using vb = vector; using vvb = vector; using vvvb = vector; const ll mod = 998244353; const ll MOD = 1000000007; using vp = vector>; #define fi first #define se second ll keta(ll a){ ll ans=0; while(a!=0){ ans+=a%10; a/=10; } return ans; } int main(){ ll N; cin>>N; vl X(100); X[0]=N; for(int i=1; i<100; i++){ X[i]=keta(X[i-1]); } cout<