/*______________________________________________Bismillahir Rahmanir Rahim____________________________________________
                                                                                                                     |
|        TTTTTTTTTTTTTTTTTTTTTTTRRRRRRRRRRRRRRRRR             888888888             66666666                         |
|        T:::::::::::::::::::::TR::::::::::::::::R          88:::::::::88          6::::::6                          |
|        T:::::::::::::::::::::TR::::::RRRRRR:::::R       88:::::::::::::88       6::::::6                           |
|        T:::::TT:::::::TT:::::TRR:::::R     R:::::R     8::::::88888::::::8     6::::::6                            |
|        TTTTTT  T:::::T  TTTTTT  R::::R     R:::::R     8:::::8     8:::::8    6::::::6                             |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::8   6::::::6                              |
|                T:::::T          R::::RRRRRR:::::R       8:::::88888:::::8   6::::::6                               |
|                T:::::T          R:::::::::::::RR         8:::::::::::::8   6::::::::66666                          |
|                T:::::T          R::::RRRRRR:::::R       8:::::88888:::::8 6::::::::::::::66                        |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86::::::66666:::::6                       |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86:::::6     6:::::6                      |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86:::::6     6:::::6                      |
|              TT:::::::TT      RR:::::R     R:::::R     8::::::88888::::::86::::::66666::::::6                      |
|              T:::::::::T      R::::::R     R:::::::R    88:::::::::::::88  66:::::::::::::66                       |
|              T:::::::::T      R::::::R     R:::::::R      88:::::::::88      66:::::::::66                         |
|              TTTTTTTTTTT      RRRRRRRR     RRRRRRRRR        888888888          666666666                           |                                                                                         |
|                                                                                                                    |
|                                            Student of Cmputer Science & Engineering                                |
|                                            Comilla University                                                      |
|                                            Email : tasfiquerishad1217@gmail.com                                    |
|                         ___________________Don't judge a book by it's cover___________________                     |
|___________________________________________________________________________________________________________________*/
#include <bits/stdc++.h>
#include<vector>
#include<iterator>
#include<stdlib.h>
#include <algorithm>
#include <cctype>
#include <utility>
#include<iostream>
using namespace std;
int DMCA(int n)
{
    int s=0;
    while(n>0)
    {
        s+=(n%10);
        n/=10;
    }
    return s;
}
int main()
{
    int t;
    cin>>t;
    int i=1;
    while(i>0)
    {
        t=DMCA(t);
        i=t/10;
    }
    cout<<t<<endl;
    return 0;
}

### Prompt

Develop a solution in cpp 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
/*______________________________________________Bismillahir Rahmanir Rahim____________________________________________
                                                                                                                     |
|        TTTTTTTTTTTTTTTTTTTTTTTRRRRRRRRRRRRRRRRR             888888888             66666666                         |
|        T:::::::::::::::::::::TR::::::::::::::::R          88:::::::::88          6::::::6                          |
|        T:::::::::::::::::::::TR::::::RRRRRR:::::R       88:::::::::::::88       6::::::6                           |
|        T:::::TT:::::::TT:::::TRR:::::R     R:::::R     8::::::88888::::::8     6::::::6                            |
|        TTTTTT  T:::::T  TTTTTT  R::::R     R:::::R     8:::::8     8:::::8    6::::::6                             |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::8   6::::::6                              |
|                T:::::T          R::::RRRRRR:::::R       8:::::88888:::::8   6::::::6                               |
|                T:::::T          R:::::::::::::RR         8:::::::::::::8   6::::::::66666                          |
|                T:::::T          R::::RRRRRR:::::R       8:::::88888:::::8 6::::::::::::::66                        |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86::::::66666:::::6                       |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86:::::6     6:::::6                      |
|                T:::::T          R::::R     R:::::R     8:::::8     8:::::86:::::6     6:::::6                      |
|              TT:::::::TT      RR:::::R     R:::::R     8::::::88888::::::86::::::66666::::::6                      |
|              T:::::::::T      R::::::R     R:::::::R    88:::::::::::::88  66:::::::::::::66                       |
|              T:::::::::T      R::::::R     R:::::::R      88:::::::::88      66:::::::::66                         |
|              TTTTTTTTTTT      RRRRRRRR     RRRRRRRRR        888888888          666666666                           |                                                                                         |
|                                                                                                                    |
|                                            Student of Cmputer Science & Engineering                                |
|                                            Comilla University                                                      |
|                                            Email : tasfiquerishad1217@gmail.com                                    |
|                         ___________________Don't judge a book by it's cover___________________                     |
|___________________________________________________________________________________________________________________*/
#include <bits/stdc++.h>
#include<vector>
#include<iterator>
#include<stdlib.h>
#include <algorithm>
#include <cctype>
#include <utility>
#include<iostream>
using namespace std;
int DMCA(int n)
{
    int s=0;
    while(n>0)
    {
        s+=(n%10);
        n/=10;
    }
    return s;
}
int main()
{
    int t;
    cin>>t;
    int i=1;
    while(i>0)
    {
        t=DMCA(t);
        i=t/10;
    }
    cout<<t<<endl;
    return 0;
}

```