# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

li = list(map(int,input().split()))
N, A, B, C = li[0], li[1], li[2], li[3]
l = sorted([ int(input()) for i in range(N) ])
an_l = sorted([A, B, C])

ans = 0
for l_n_ind, l_n in enumerate(an_l):
    score = 10
    l_i_ind = None
    for ind, l_i in enumerate(l):
        tmp_score = abs(l_n-l_i)
        if tmp_score < score:
            score = tmp_score
            l_i_ind = ind
    if l_i_ind is not None:
        ans += score
        l.pop(l_i_ind)
        an_l.pop(l_n_ind)

# an_sum = sum(an_l)
# d = { i: 999999 for i in range(li)}

for l_n_ind, l_n in enumerate(an_l):
    score = 99999
    l_i_inds = []
    for i in range(1 << len(l)):
        output = []
        output_ind = []
        l_i_ind = None
        for j in range(len(l)):
            if ((i >> j) & 1) == 1:
                output.append(l[j])
                output_ind.append(j)
        if len(output) == 0:
            continue
        tmp_score = abs(sum(output)-l_n)
        if tmp_score < score:
            score = tmp_score
            l_i_inds = output_ind

    ans += (score + (len(l_i_inds)-1)*10)
    for tt in l_i_inds[::-1]:
        l.pop(tt)

# print(an_l)
# print(l)
print(ans)

