N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF
  
  # 使わない場合
  ret0 = dfs(cur + 1, A, B, C)
  # A に使う場合
  ret1 = dfs(cur + 1, A + l[cur], B, C) + 10
  # B に使う場合
  ret2 = dfs(cur + 1, A, B + l[cur], C) + 10
  # C に使う場合
  ret3 = dfs(cur + 1, A, B, C + l[cur]) + 10
  
  return min(ret0, ret1, ret2, ret3)
  
print(defs(0, 0, 0, 0))