# -*- coding: utf-8 -*-



instr = eval(input())



print((instr.count("1")))
# -*- coding: utf-8 -*-



print((input().count("1")))
# -*- coding: utf-8 -*-
instr = eval(input())
print((instr.count("1")))

# -*- coding: utf-8 -*-
print((input().count("1")))

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