
n,A,B,C = map(int, input().split())
l = list([int(input()) for _ in range(n)])

big=10**9

def dp(cur,a,b,c):
  if cur==n:
    if a==0 or b==0 or c==0:
      return big
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)-30
  else:
    ret0 = dp(cur+1,a,b,c)
    ret1 = dp(cur+1,a+l[cur],b,c)+10
    ret2 = dp(cur+1,a,b+l[cur],c)+10
    ret3 = dp(cur+1,a,b,c+l[cur])+10
    return min([ret0, ret1, ret2, ret3])

ret=dp(0,0,0,0)
print(ret)