#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int 
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define br cout<<"\n"
#define pb push_back
#define all(x) x.begin(), x.end() 
#define mp make_pair
#define maxheap    priority_queue<ll>
#define minheap    priority_queue<ll,vector<ll>,greater<ll> >
#define mem(a,s) memset(a,s,sizeof(a))
#define rep(i,a,b) for(ll i=a;i<b;i++)
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
const long long INF=1e18;
#define ps(x,y)             fixed<<setprecision(y)<<x
bool comp(int a, int b) 
{ 
    return (a < b); 
} 

int main(){
    fast;
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin); 
        freopen("error.txt", "w", stderr); 
        freopen("output.txt", "w", stdout); 
   #endif
    ll t=1;
    //cin>>t;
    while(t--){
        ll n;
        cin>>n;
        n=n%9;
        if(n==0)n=9;
        cout<<n;
        
        br;
    }
    return 0;
}

### Prompt

Generate a CPP solution to the following problem:

Many people are aware of DMCA – Digital Millennium Copyright Act. But another recently proposed DMCA – Digital Millennium Calculation Act – is much less known.

In this problem you need to find a root of a number according to this new DMCA law.

Input

The input contains a single integer a (1 ≤ a ≤ 1000000).

Output

Output the result – an integer number.

Examples

Input


1


Output


1


Input


81


Output


9

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int 
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define br cout<<"\n"
#define pb push_back
#define all(x) x.begin(), x.end() 
#define mp make_pair
#define maxheap    priority_queue<ll>
#define minheap    priority_queue<ll,vector<ll>,greater<ll> >
#define mem(a,s) memset(a,s,sizeof(a))
#define rep(i,a,b) for(ll i=a;i<b;i++)
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
const long long INF=1e18;
#define ps(x,y)             fixed<<setprecision(y)<<x
bool comp(int a, int b) 
{ 
    return (a < b); 
} 

int main(){
    fast;
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin); 
        freopen("error.txt", "w", stderr); 
        freopen("output.txt", "w", stdout); 
   #endif
    ll t=1;
    //cin>>t;
    while(t--){
        ll n;
        cin>>n;
        n=n%9;
        if(n==0)n=9;
        cout<<n;
        
        br;
    }
    return 0;
}

```