s = eval(input())

print((s.count('1')))
MarbleList = list(eval(input()))



num=MarbleList.count('1')

print(num)

s = eval(input())
print((s.count("1")))

MarbleList = list(eval(input()))
num = MarbleList.count("1")
print(num)

-s = eval(input()) -print((s.count("1"))) +MarbleList = list(eval(input())) +num = MarbleList.count("1") +print(num)