from itertools import product

N,A,B,C=map(int,input().split())
l = [int(input()) for _ in range(N)]

minscore=10**9
for p in product(range(-1,3),repeat=N):
  flag=0
  score = 0
  n_abc=[0,0,0]
  sumlen = [0,0,0]
  for i in range(N):
    if p[i] != -1:
      n_abc[p[i]] += 1
      sumlen[p[i]] += l[i]
  for j in range(3):
    if n_abc[j] == 0:
      flag=1
      break
    score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j])
    
  if flag:
    continue
    
  if score < minscore:
    minscore = score
    
print(minscore) from itertools import product 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 _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) int(input()) int input() input l = [int(input()) for _ in range(N)] l [int(input()) for _ in range(N)] minscore=10**9 minscore 10**9 10 9 for p in product(range(-1,3),repeat=N):
  flag=0
  score = 0
  n_abc=[0,0,0]
  sumlen = [0,0,0]
  for i in range(N):
    if p[i] != -1:
      n_abc[p[i]] += 1
      sumlen[p[i]] += l[i]
  for j in range(3):
    if n_abc[j] == 0:
      flag=1
      break
    score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j])
    
  if flag:
    continue
    
  if score < minscore:
    minscore = score
     p product(range(-1,3),repeat=N) product range(-1,3) range -1 3 repeat=N repeat N flag=0 flag 0 score = 0 score 0 n_abc=[0,0,0] n_abc [0,0,0] 0 0 0 sumlen = [0,0,0] sumlen [0,0,0] 0 0 0 for i in range(N):
    if p[i] != -1:
      n_abc[p[i]] += 1
      sumlen[p[i]] += l[i]
   i range(N) range N if p[i] != -1:
      n_abc[p[i]] += 1
      sumlen[p[i]] += l[i]
   p[i] != -1 p[i] p i -1 n_abc[p[i]] += 1 n_abc[p[i]] n_abc p[i] p i 1 sumlen[p[i]] += l[i] sumlen[p[i]] sumlen p[i] p i l[i] l i for j in range(3):
    if n_abc[j] == 0:
      flag=1
      break
    score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j])
    
   j range(3) range 3 if n_abc[j] == 0:
      flag=1
      break
     n_abc[j] == 0 n_abc[j] n_abc j 0 flag=1 flag 1 break score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j]) score (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j]) (n_abc[j]-1)*10 n_abc[j]-1 n_abc[j] n_abc j 1 10 abs(sumlen[j]-[A,B,C][j]) abs sumlen[j]-[A,B,C][j] sumlen[j] sumlen j [A,B,C][j] [A,B,C] A B C j if flag:
    continue
    
   flag continue if score < minscore:
    minscore = score
     score < minscore score minscore minscore = score minscore score print(minscore) print minscore score = 0 0 score minscore=10**9 10**9 minscore n_abc=[0,0,0] [0,0,0] n_abc N,A,B,C=map(int,input().split()) map(int,input().split()) N flag=0 0 flag sumlen = [0,0,0] [0,0,0] sumlen A,B,C=map(int,input().split()) map(int,input().split()) A C=map(int,input().split()) map(int,input().split()) C l = [int(input()) for _ in range(N)] [int(input()) for _ in range(N)] l score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j]) (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j]) score flag=1 1 flag minscore = score score minscore B,C=map(int,input().split()) map(int,input().split()) B
from itertools import product

N,A,B,C=map(int,input().split())
l = [int(input()) for _ in range(N)]

minscore=10**9
for p in product(range(-1,3),repeat=N):
  flag=0
  score = 0
  n_abc=[0,0,0]
  sumlen = [0,0,0]
  for i in range(N):
    if p[i] != -1:
      n_abc[p[i]] += 1
      sumlen[p[i]] += l[i]
  for j in range(3):
    if n_abc[j] == 0:
      flag=1
      break
    score += (n_abc[j]-1)*10 + abs(sumlen[j]-[A,B,C][j])
    
  if flag:
    continue
    
  if score < minscore:
    minscore = score
    
print(minscore)