import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from fractions import gcd
from functools import lru_cache, reduce

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, A, B, C = list(map(int, sys.stdin.readline().split()))
L = [int(sys.stdin.readline()) for _ in range(N)]

L = np.array(L)

# 全部試す
choosing = list(itertools.product([0, 1, 2, 3], repeat=N))
# 0: 選ばない
# 1: 竹 A にする
# 2: 竹 B にする
# 3: 竹 C にする
ans = INF
for choose in np.array(choosing):
    a = L[choose == 1]
    b = L[choose == 2]
    c = L[choose == 3]
    if len(a) == 0 or len(b) == 0 or len(c) == 0:
        continue
    s = 0
    s += abs(A - a.sum()) + (len(a) - 1) * 10
    s += abs(B - b.sum()) + (len(b) - 1) * 10
    s += abs(C - c.sum()) + (len(c) - 1) * 10
    ans = min(ans, s)
print(ans)
