import sequtils, strutils, math, algorithm

var
  nabc = readLine(stdin).split().map(parseInt)
  n = nabc[0]
  abc = nabc[1..^1]
  l: seq[int]
  INF = 10^9
for i in 1..n:
  l.add(parseint(readLine(stdin)))

proc dfs(cur:int, a:int, b:int, c:int): int =
  if cur == n:
    if min(@[a, b, c]) > 0:
      return abs(a - abc[0]) + abs(b - abc[1]) + abs(c - abc[2]) - 30
    else:
      return INF
  var
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(@[ret0, ret1, ret2, ret3])

echo dfs(0, 0, 0, 0)