(N,A,B,C)=map(int,input().split())
2
L=[]
3
for i in range(N):
4
  L.append(int(input()))
5
  
6
L_sums=[]
7
costs=[]
8
#bin_is=[]
9
for i in range(2**N+1,2**N+2**N):
10
  bin_i=str(bin(i))[2:]
11
  L_sum=0
12
  cost=-1
13
  for j in range(N):
14
    L_sum+=L[j]*int(bin_i[j+1])
15
    cost+=int(bin_i[j+1])
16
  L_sums.append(L_sum)
17
  costs.append(10*cost)
18
  #bin_is.append(bin_i)
19
​
20
cost_A=[]
21
for i in range(2**N-1):
22
  cost_A.append(costs[i]+abs(L_sums[i]-A))
23
min_cost_A=min(cost_A)
24
min_cost_A_index=cost_A.index(min(cost_A))+1
25
min_cost_A_index_bin=str(bin(min_cost_A_index+2**N))[2:]
26
for i in range(N):
27
  if min_cost_A_index_bin[i+1]=='1':
28
    del(L[i])
29
N=len(L)
30
#-------------------
31
L_sums=[]
32
costs=[]
33
#bin_is=[]
34
for i in range(2**N+1,2**N+2**N):
35
  bin_i=str(bin(i))[2:]
36
  L_sum=0
37
  cost=-1
38
  for j in range(N):
39
    L_sum+=L[j]*int(bin_i[j+1])
40
    cost+=int(bin_i[j+1])
41
  L_sums.append(L_sum)
42
  costs.append(10*cost)
43
  #bin_is.append(bin_i)
44
​
45
cost_B=[]
46
for i in range(2**N-1):
47
  cost_B.append(costs[i]+abs(L_sums[i]-B))
48
min_cost_B=min(cost_B)
49
min_cost_B_index=cost_B.index(min(cost_B))+1
50
min_cost_B_index_bin=str(bin(min_cost_B_index+2**N))[2:]
51
for i in range(N):
52
  if min_cost_B_index_bin[i]=='1':
53
    del(L[i])
54
N=len(L)
55
#-----------------
56
L_sums=[]
57
costs=[]
58
#bin_is=[]
59
for i in range(2**N+1,2**N+2**N):
60
  bin_i=str(bin(i))[2:]
61
  L_sum=0
62
  cost=-1
63
  for j in range(N):
64
    L_sum+=L[j]*int(bin_i[j+1])
65
    cost+=int(bin_i[j+1])
66
  L_sums.append(L_sum)
67
  costs.append(10*cost)
68
  #bin_is.append(bin_i)
69
​
70
cost_C=[]
71
for i in range(2**N-1):
72
  cost_C.append(costs[i]+abs(L_sums[i]-C))
73
min_cost_C=min(cost_C)
74
#min_cost_C_index=cost_C.index(min(cost_C))+1
75
#min_cost_C_index_bin=str(bin(min_cost_C_index))[2:]
76
#for i in range(N):
77
#  if min_cost_C_index_bin[i]=='1':
78
#    del(L[i])
79
#N=len(L)
80
#----------------
81
print(min_cost_A+min_cost_B+min_cost_C)