a1, b1, a2, b2, a3, b3 = map(int, input().split()) total = a1**b1 + a2**b2 + a3**b3 print(total % 2 == 0)