# -*- coding: utf-8 -*-


import sys
import math

n, a, b, c = list(map(int, input().split()))

l = []
for i in range(n):
    l.append(int(input()))


##llのリストの時の最小MPを返す
# これは愚直に伸び縮みさせる or 任意の2本をくっつけた時の再起関数の値+10の最小
def saiki(ll: []):
    if (len(ll) == 3):
        ret = 0
        ret += abs(ll[0] - c)
        ret += abs(ll[1] - b)
        ret += abs(ll[2] - a)
        # print('len ' + str(ll) + ' min ' + str(ret))
        return ret
    ret = 99999999
    ##愚直なやつ
    next = sorted(ll)
    llen = len(ll)
    for aa in range(llen - 2):
        for bb in range(aa + 1, llen - 1):
            for cc in range(bb + 1, llen):
                ret = min(saiki([next[aa], next[bb], next[cc]]), ret)

    ##任意の2つをつなげて再起
    for a1 in range(llen - 1):
        next = ll.copy()
        del (next[a1])
        for a2 in range(a1, llen - 1):
            next[a2] += ll[a1]
            ret = min(ret, 10 + saiki(next))
            next[a2] -= ll[a1]
    # print('len ' + str(ll) + ' min ' + str(ret))
    return ret


print(saiki(l))
