N, i = list(map(int,input().split()))

print((N-i+1))
a, b = list(map(int, input().split()))

print((a - b + 1))

N, i = list(map(int, input().split()))
print((N - i + 1))

a, b = list(map(int, input().split()))
print((a - b + 1))

-N, i = list(map(int, input().split())) -print((N - i + 1)) +a, b = list(map(int, input().split())) +print((a - b + 1))