n=int(input()) a=list(map(int,input().split()));a.sort() x,y=map(int,input().split()) if max(x,y)==0: print(0) exit() if max(abs(x),abs(y))