# 读取四位整数并转换为字符串
n_str = input().strip()

# 初始化总和为0
total = 0

# 遍历字符串中的每个字符,转换为整数后累加
for c in n_str:
    total += int(c)

# 输出结果
print(total)