N,A,B,C = map(int,input().split())

L = [int(input()) for i in range(N)]

# L本の竹を、A,B,C,0(使わない)に振り分ける全探索 4^N = 約60000通り

ans = 10 ** 10
import itertools
for prod in itertools.product(range(4), repeat = N):
  bamboo = [0] * 4
  mp = 0
  for i in range(len(prod)):
    if prod[i] == 0:
      continue
    if bamboo[prod[i]] != 0:
      mp += 10
    bamboo[prod[i]] += L[i]
  if 0 in bamboo[1:]:
    continue
  mp += abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3])
  if ans > mp:
    ans = mp
    
print(ans) N,A,B,C = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split A B C int(input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(input()) int input() input L = [int(input()) for i in range(N)] L [int(input()) for i in range(N)] ans = 10 ** 10 ans 10 ** 10 10 10 import itertools itertools for prod in itertools.product(range(4), repeat = N):
  bamboo = [0] * 4
  mp = 0
  for i in range(len(prod)):
    if prod[i] == 0:
      continue
    if bamboo[prod[i]] != 0:
      mp += 10
    bamboo[prod[i]] += L[i]
  if 0 in bamboo[1:]:
    continue
  mp += abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3])
  if ans > mp:
    ans = mp
     prod itertools.product(range(4), repeat = N) itertools.product itertools product range(4) range 4 repeat = N repeat N bamboo = [0] * 4 bamboo [0] * 4 [0] 0 4 mp = 0 mp 0 for i in range(len(prod)):
    if prod[i] == 0:
      continue
    if bamboo[prod[i]] != 0:
      mp += 10
    bamboo[prod[i]] += L[i]
   i range(len(prod)) range len(prod) len prod if prod[i] == 0:
      continue
     prod[i] == 0 prod[i] prod i 0 continue if bamboo[prod[i]] != 0:
      mp += 10
     bamboo[prod[i]] != 0 bamboo[prod[i]] bamboo prod[i] prod i 0 mp += 10 mp 10 bamboo[prod[i]] += L[i] bamboo[prod[i]] bamboo prod[i] prod i L[i] L i if 0 in bamboo[1:]:
    continue
   0 in bamboo[1:] 0 bamboo[1:] bamboo 1: 1 continue mp += abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3]) mp abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3]) abs(A - bamboo[1]) + abs(B - bamboo[2]) abs(A - bamboo[1]) abs A - bamboo[1] A bamboo[1] bamboo 1 abs(B - bamboo[2]) abs B - bamboo[2] B bamboo[2] bamboo 2 abs(C - bamboo[3]) abs C - bamboo[3] C bamboo[3] bamboo 3 if ans > mp:
    ans = mp
     ans > mp ans mp ans = mp ans mp print(ans) print ans mp += abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3]) abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3]) mp C = map(int,input().split()) map(int,input().split()) C B,C = map(int,input().split()) map(int,input().split()) B mp = 0 0 mp L = [int(input()) for i in range(N)] [int(input()) for i in range(N)] L bamboo = [0] * 4 [0] * 4 bamboo ans = mp mp ans mp += 10 10 mp A,B,C = map(int,input().split()) map(int,input().split()) A ans = 10 ** 10 10 ** 10 ans N,A,B,C = map(int,input().split()) map(int,input().split()) N
N,A,B,C = map(int,input().split())

L = [int(input()) for i in range(N)]

# L本の竹を、A,B,C,0(使わない)に振り分ける全探索 4^N = 約60000通り

ans = 10 ** 10
import itertools
for prod in itertools.product(range(4), repeat = N):
  bamboo = [0] * 4
  mp = 0
  for i in range(len(prod)):
    if prod[i] == 0:
      continue
    if bamboo[prod[i]] != 0:
      mp += 10
    bamboo[prod[i]] += L[i]
  if 0 in bamboo[1:]:
    continue
  mp += abs(A - bamboo[1]) + abs(B - bamboo[2]) + abs(C - bamboo[3])
  if ans > mp:
    ans = mp
    
print(ans)