#include int main() { int num; int box = 0; int i; scanf("%d", &num); if((0 <= num ) && (num < 10)) { printf("%d\n", num); return 0; } else if((10 <= num ) && (num < 100)) { box = (num / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((100 <= num) && (num < 1000)) { box = (num / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((1000 <= num) && (num < 10000)) { box = num / 1000; box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((10000 <= num) && (num < 100000)) { box = num / 10000; box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((100000 <= num) && (num < 1000000)) { box = num / 100000; box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((1000000 <= num) && (num < 10000000)) { box = num / 1000000; box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((10000000 <= num) && (num < 100000000)) { box = num / 10000000; box = box + ((num % 10000000) / 1000000); box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); printf("%d\n", box); return 0; } else if((100000000 <= num) && (num < 1000000000)) { box = num / 100000000; box = box + ((num % 100000000) / 10000000); box = box + ((num % 10000000) / 1000000); box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + ((num % 10)); printf("%d\n", box); return 0; } else if(num == 1000000000) { box = num / 1000000000; box = num + ((num % 1000000000) / 100000000); box = num + ((num % 100000000) / 10000000); box = num + ((num % 10000000) / 1000000); box = num + ((num % 1000000) / 100000); box = num + ((num % 100000) / 10000); box = num + ((num % 10000) / 1000); box = num + ((num % 1000) / 100); box = num + ((num % 100) / 10); box = num + (num % 10); printf("%d\n", box); return 0; } return 0; }