# encoding:utf-8
import copy
import numpy as np
import random

n,a,b,c = map(int,input().split())
l = []
for i in range(n):
    l.append(int(input()))

def to_4digit(i):
    digits = [0]*n
    digit = 0
    while(i>1):
        digits[digit] = i%4
        digit += 1
        i//=4
    return digits

ans = 10**20
for i in range(4**n):
    choice = to_4digit(i)
    abc = [0 for i in range(3)]
    mp = 0
    for j in range(len(choice)):
        if choice[j]==3:#trash
            pass
        else:
            if abc[choice[j]]!=0:
                mp += 10
            abc[choice[j]] += l[j]
    if 0 in abc:
        pass
    else:
        mp += abs(abc[0]-a)+abs(abc[1]-b)+abs(abc[2]-c)
        ans = min(ans,mp)
    # print(ans)
print(ans)
