n = eval(input())

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

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

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

-n = eval(input()) -print((n.count("1"))) +s = eval(input()) +print((s.count("1")))