一、题目
二、解题
t = [int(x) for x in input().split(' ')]
k = []
for i in range(0, 4, 2):
a = 0
index = 0
while t[i] != 0:
if t[i] % 10 == t[i + 1]:
a += t[i+1]*pow(10, index)
index += 1
t[i] //= 10
k.append(a)
print(sum(k))