#include <stdio.h>

int main()
 {
    int z = 0;
    scanf("%d",&z);
    int one,ten,hundred,thousand;
    one = z % 10;
    ten = (z / 10) % 10;
    hundred = (z / 100) % 10;
    thousand = z / 1000;
    int result = 0;
    result = one + ten + hundred + thousand;
    printf("%d",result);
    return 0;
}