#include int main(void) { int n; int i; int a; int sum; scanf("%d", &n); a = n; for(i = 1;i <= 100;i++){ sum = 0; n = a; while(n != 0){ sum += n % 10; n /= 10; } a = sum; } printf("%d\n", a); return 0; }