while True:

    n = list(eval(input()))

    if n[0] == '0':

        break

    sum = 0

    for i in n:

        sum += int(i)

    print(sum)
while True:

    n = eval(input())

    if n == '0':

        break

    sum = 0

    for i in n:

        sum += int(i)

    print(sum)
while True:
    n = list(eval(input()))
    if n[0] == "0":
        break
    sum = 0
    for i in n:
        sum += int(i)
    print(sum)

while True:
    n = eval(input())
    if n == "0":
        break
    sum = 0
    for i in n:
        sum += int(i)
    print(sum)

-    n = list(eval(input())) -    if n[0] == "0": +    n = eval(input()) +    if n == "0":