#coding:utf-8
import sys

BAMB_NUM = 0
BAMB_A = 0
BAMB_B = 0
BAMB_C = 0
BAMB_LIST = []

def calcMP(idx, lenA, lenB, lenC):
    """
    calculate MP.
    """
    # when classified all bamboos
    if (idx == BAMB_NUM):
        # exists a zero length bamboo
        if (lenA <= 0 or lenB <= 0 or lenC <= 0):
            return sys.maxsize
        else:
            return abs(lenA - BAMB_A) + abs(lenB - BAMB_B) + abs(lenC - BAMB_C)
    
    # don't use idx-th bamboo
    mp = calcMP(idx + 1, lenA, lenB, lenC)

    # use idx-th bamboo
    mp = min(mp, calcMP(idx + 1, lenA + BAMB_LIST[idx], lenB, lenC) + (10 if BAMB_A > 0 else 0))
    mp = min(mp, calcMP(idx + 1, lenA, lenB + BAMB_LIST[idx], lenC) + (10 if BAMB_B > 0 else 0))
    mp = min(mp, calcMP(idx + 1, lenA, lenB, lenC + BAMB_LIST[idx]) + (10 if BAMB_C > 0 else 0))

    return mp

if __name__ == "__main__":
    """
    http://drken1215.hatenablog.com/entry/2019/02/24/224100
    """
    # requested bamboo lengths
    BAMB_NUM, BAMB_A, BAMB_B, BAMB_C = map(lambda x: int(x), input().split())
    # available bamboo lengths
    for bamb in range(BAMB_NUM):
        BAMB_LIST.append(int(input()))

    mp = calcMP(0, 0, 0, 0)
    print(mp)