#include int main() { int N; if (scanf("%d", &N) != 1) { return -1; } for (int i = 1; i <= 100; i++) { int tmp = 0; while (N != 0) { tmp += N % 10; N = (N - (N % 10)) / 10; } N = tmp; } printf("%d", N); return 0; }