import itertools
N, A, B, C = map(int, raw_input().split())
banboos = [int(raw_input()) for _ in range(N)]

INF = 10**9
#saw banboos from 0 to k-1 and the length is a, b, c
#see the k'th banboo and return the smallest cost
def dfs(k, a, b, c):
  if k == N:
    return abs(a-A)+abs(b-B)+abs(c-C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(k+1, a, b, c)
  ret1 = dfs(k+1, a+banboos[k], b, c)+10
  ret2 = dfs(k+1, a, b+banboos[k],  c)+10
  ret3 = dfs(k+1, a, b, c+banboos[k])+10
  return min(ret0, ret1, ret2, ret3)
print dfs(0, 0, 0, 0)

