#include <stdio.h> int sum(int x) { int sum; while(x > 0) { int digit = x % 10; sum += digit; x /= 10; } return sum; } int main() { int x; scanf("%d",&x); int result = sum(x); printf("%d",result); return 0; }