s = eval(input())



result = 0

if s[0] == "1":

    result += 1

if s[1] == "1":

    result += 1

if s[2] == "1":

    result += 1

print(result)

s = eval(input())



result = 0

for _s in s:

    if _s == '1':

        result += 1



print(result)

s = eval(input())
result = 0
if s[0] == "1":
    result += 1
if s[1] == "1":
    result += 1
if s[2] == "1":
    result += 1
print(result)

s = eval(input())
result = 0
for _s in s:
    if _s == "1":
        result += 1
print(result)

-if s[0] == "1": -    result += 1 -if s[1] == "1": -    result += 1 -if s[2] == "1": -    result += 1 +for _s in s: +    if _s == "1": +        result += 1