/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

#define ll long long int 
#define ld long double 

using namespace std;

void Void(){
    int64_t n;
    cin >> n;
    while(n >= 10){
        int64_t sum = 0;
        int64_t a = n;
        while(a != 0){
            sum += a % 10;
            a /= 10;
        }
        n = sum;
    }
    cout << n << endl;
}

int main(){
    int t = 1;
//    cin >> t;
    while(t--)Void();
    return 0;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

#define ll long long int 
#define ld long double 

using namespace std;

void Void(){
    int64_t n;
    cin >> n;
    while(n >= 10){
        int64_t sum = 0;
        int64_t a = n;
        while(a != 0){
            sum += a % 10;
            a /= 10;
        }
        n = sum;
    }
    cout << n << endl;
}

int main(){
    int t = 1;
//    cin >> t;
    while(t--)Void();
    return 0;
}

```