# coding: utf-8

M1, D1 = (int(x) for x in input().split())
M2, D2 = (int(x) for x in input().split())

if M1 == M2: print(0)
else: print(1)

71a12e2c3c8ab953c219a17b4a8f2fe793e00c91
<mask token>

<mask token>
if M1 == M2:
    print(0)
else:
    print(1)

M1, D1 = (int(x) for x in input().split())
M2, D2 = (int(x) for x in input().split())
if M1 == M2:
    print(0)
else:
    print(1)

# coding: utf-8

M1, D1 = (int(x) for x in input().split())
M2, D2 = (int(x) for x in input().split())

if M1 == M2: print(0)
else: print(1)
