#include using namespace std; int main(){ int n; cin >> n; for(int i = 0; i < 100; i++){ int old = n; n = 0; while(old > 0){ n += old%10; old /= 10; } } cout << n << endl; return 0; }