# 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**10
for i in range(4**n):
    choice = to_4digit(i)
    a_tem = 0
    b_tem = 0
    c_tem = 0
    mp = 0
    for j in range(len(choice)):
        if choice[j]==0:
            if a_tem != 0:
                mp += 10
            a_tem += l[j]
        elif choice[j]==1:
            if b_tem != 0:
                mp += 10
            b_tem+= l[j]
        elif choice[j]==2:
            if c_tem != 0:
                mp += 10
            c_tem+= l[j]
        else:pass
    if a_tem==0 or b_tem==0 or c_tem==0:
        pass
    else:
        mp += abs(a-a_tem)+abs(b-b_tem)+abs(c-c_tem)
        ans = min(ans,mp)
    # print(ans)
print(ans)


# print(to_4digit(10))
