a = int(input()) b = int(a/1000) c = int(a % 1000 / 100) d = int (a /10 % 10) e = int(a % 10) sum = b+c+d+e print(sum)