n=int(input()) x=int(input()) y=int(input()) z=int(input()) a=[] for i in range(n): a.append(int(input())) s=(x*1)+(y*2)+(z*3) c=0 for i in a: if i