import collections
N,A,B,C = map(int, input().split(" "))

L = [int(input()) for i in range(N)]

def solve():
  if A in L and B in L and C in L:
    print(0)
    return
  if(len(L) == 3):
    print(sum(L)-sum([A,B,C]))
  
solve()