import math
import numpy as np
import itertools

N, A, B, C = list(map(int, input().split(" ")))
l_list = np.asarray(sorted([int(input()) for _ in range(N)]))

def calc_mp(X, in_list):
    n_elm = len(in_list)
    mps = []
    ans = np.min(np.abs(in_list - X))
    if n_elm >= 2:
        ans2 = min([abs(in_list[i] + in_list[j] - X) for i in range(n_elm) for j in range(i+1, n_elm)]) + 10
        #print(ans1, ans2)
        ans = min(ans, ans2)
    if n_elm >= 3:
        ans3 = min([abs(in_list[i0] + in_list[i1] + in_list[i2] - X) for i0 in range(n_elm) for i1 in range(i0+1, n_elm) for i2 in range(i1+1, n_elm)]) + 10 + 10
        #print(ans1, ans2)
        ans = min(ans, ans3)
    return ans

mps = []
for belongings in itertools.product(*[range(3) for _ in range(N)]):
    bs = np.asarray(belongings)
    l_list0 = l_list[bs==0]
    l_list1 = l_list[bs==1]
    l_list2 = l_list[bs==2]
    #print(l_list0, l_list1, l_list2)
    if 0 in [len(l_list0), len(l_list1), len(l_list2)]:
        continue

    a_mp = calc_mp(A, l_list0)
    b_mp = calc_mp(B, l_list1)
    c_mp = calc_mp(C, l_list2)
    cur_mp = a_mp+b_mp+c_mp
    #print(cur_mp, a_mp, b_mp, c_mp)
    mps.append(cur_mp)

print(min(mps))