n,a,b,c = map(int,input().split())
la = [a,b,c]
lt = [int(input()) for i in range(n)]

import itertools as it
ans = 3000
for p in it.product(range(4),repeat=n):
  ll = [0]*4
  lc = [0]*4
  for i in range(n):
    ll[p[i]] += lt[i]
    lc[p[i]] += 1
  if lc[0]*lc[1]*lc[2] > 0:
    mp = 10*(sum(lc[:3])-3) + sum(abs(ll[i]-la[i]) for i in range(3))
    ans = min(ans, mp)
print(ans)