#include<stdio.h>int func(__int64 x){ int h,a; for(h=0;x>0;x=x/10) { a=x%10; h+=a; } return h;}void main(){ __int64 x; while(1) { scanf("%I64d",&x); printf("%d\n",(int)func(x)); }}