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

def settify(j, n): #sが集合ラベル, nが多重度
  i = 0
  ans = [set() for _ in range(n)]
  while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
  return ans

def set_label(st): #setをlabel化する
  rtn = 0
  for j in st:
    rtn += 2**j 
  return rtn

def cost(s, L): #s:集合ラベル（使う竹）, L:目標長
  if s == 0:
    return 10**20
  st = settify(s, 2)[1]
  #print(st, s)
  l_first = 0
  for i in st:
    l_first += l[i] #とりあえず全部足す
  return 10*(len(st)-1) + abs(l_first - L) #最小コストを返す
  

#前準備
cost = [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ]

#print(cost)

mi = 10**20
for j in range(4**N):
  sets = settify(j, 4)
  q = [0, 0, 0]
  tmp = 0
  for p in range(3):
    tmp += cost[p][set_label(sets[p])]
  mi = min(mi, tmp)
  
print(mi) 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)] def settify(j, n): #sが集合ラベル, nが多重度
  i = 0
  ans = [set() for _ in range(n)]
  while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
  return ans settify i = 0 i 0 set() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) set() set ans = [set() for _ in range(n)] ans [set() for _ in range(n)] while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
   i < N i N ans[j % n].add(i) [j % n].add [j % n] ans j % n j n add i i += 1 i 1 j //= n j n return ans ans j j n n def set_label(st): #setをlabel化する
  rtn = 0
  for j in st:
    rtn += 2**j 
  return rtn set_label rtn = 0 rtn 0 for j in st:
    rtn += 2**j 
   j st rtn += 2**j rtn 2**j 2 j return rtn rtn st st def cost(s, L): #s:集合ラベル（使う竹）, L:目標長
  if s == 0:
    return 10**20
  st = settify(s, 2)[1]
  #print(st, s)
  l_first = 0
  for i in st:
    l_first += l[i] #とりあえず全部足す
  return 10*(len(st)-1) + abs(l_first - L) #最小コストを返す
  

#前準備 cost if s == 0:
    return 10**20
   s == 0 s 0 return 10**20 10**20 10 20 st = settify(s, 2)[1] st settify(s, 2)[1] (s, 2) settify s 2 1 l_first = 0 l_first 0 for i in st:
    l_first += l[i] #とりあえず全部足す
   i st l_first += l[i] l_first l[i] l i return 10*(len(st)-1) + abs(l_first - L) 10*(len(st)-1) + abs(l_first - L) 10*(len(st)-1) 10 len(st)-1 len(st) len st 1 abs(l_first - L) abs l_first - L l_first L s s L L cost(s2, A) for s2 in range(2**N) for s2 in range(2**N) s2 range(2**N) range 2**N 2 N for s2 in range(2**N) cost(s2, A) cost s2 A cost = [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ] cost [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ] [cost(s2, A) for s2 in range(2**N)] [cost(s2, B) for s2 in range(2**N)] [cost(s2, C) for s2 in range(2**N)] mi = 10**20 mi 10**20 10 20 for j in range(4**N):
  sets = settify(j, 4)
  q = [0, 0, 0]
  tmp = 0
  for p in range(3):
    tmp += cost[p][set_label(sets[p])]
  mi = min(mi, tmp)
   j range(4**N) range 4**N 4 N sets = settify(j, 4) sets settify(j, 4) settify j 4 q = [0, 0, 0] q [0, 0, 0] 0 0 0 tmp = 0 tmp 0 for p in range(3):
    tmp += cost[p][set_label(sets[p])]
   p range(3) range 3 tmp += cost[p][set_label(sets[p])] tmp cost[p][set_label(sets[p])] [p] cost p set_label(sets[p]) set_label sets[p] sets p mi = min(mi, tmp) mi min(mi, tmp) min mi tmp print(mi) print mi q = [0, 0, 0] [0, 0, 0] q tmp = 0 0 tmp def cost(s, L): #s:集合ラベル（使う竹）, L:目標長
  if s == 0:
    return 10**20
  st = settify(s, 2)[1]
  #print(st, s)
  l_first = 0
  for i in st:
    l_first += l[i] #とりあえず全部足す
  return 10*(len(st)-1) + abs(l_first - L) #最小コストを返す
  

#前準備 def cost(s, L): #s:集合ラベル（使う竹）, L:目標長
  if s == 0:
    return 10**20
  st = settify(s, 2)[1]
  #print(st, s)
  l_first = 0
  for i in st:
    l_first += l[i] #とりあえず全部足す
  return 10*(len(st)-1) + abs(l_first - L) #最小コストを返す
  

#前準備 cost cost = [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ] [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ] cost def set_label(st): #setをlabel化する
  rtn = 0
  for j in st:
    rtn += 2**j 
  return rtn def set_label(st): #setをlabel化する
  rtn = 0
  for j in st:
    rtn += 2**j 
  return rtn set_label B, C = map(int, input().split()) map(int, input().split()) B tmp += cost[p][set_label(sets[p])] cost[p][set_label(sets[p])] tmp mi = 10**20 10**20 mi l = [int(input()) for _ in range(N)] [int(input()) for _ in range(N)] l N, A, B, C = map(int, input().split()) map(int, input().split()) N def settify(j, n): #sが集合ラベル, nが多重度
  i = 0
  ans = [set() for _ in range(n)]
  while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
  return ans def settify(j, n): #sが集合ラベル, nが多重度
  i = 0
  ans = [set() for _ in range(n)]
  while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
  return ans settify sets = settify(j, 4) settify(j, 4) sets A, B, C = map(int, input().split()) map(int, input().split()) A C = map(int, input().split()) map(int, input().split()) C mi = min(mi, tmp) min(mi, tmp) mi
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]

def settify(j, n): #sが集合ラベル, nが多重度
  i = 0
  ans = [set() for _ in range(n)]
  while i < N:
    ans[j % n].add(i)
    i += 1
    j //= n
  return ans

def set_label(st): #setをlabel化する
  rtn = 0
  for j in st:
    rtn += 2**j 
  return rtn

def cost(s, L): #s:集合ラベル（使う竹）, L:目標長
  if s == 0:
    return 10**20
  st = settify(s, 2)[1]
  #print(st, s)
  l_first = 0
  for i in st:
    l_first += l[i] #とりあえず全部足す
  return 10*(len(st)-1) + abs(l_first - L) #最小コストを返す
  

#前準備
cost = [ 
  [cost(s2, A) for s2 in range(2**N)]
, [cost(s2, B) for s2 in range(2**N)]
, [cost(s2, C) for s2 in range(2**N)] ]

#print(cost)

mi = 10**20
for j in range(4**N):
  sets = settify(j, 4)
  q = [0, 0, 0]
  tmp = 0
  for p in range(3):
    tmp += cost[p][set_label(sets[p])]
  mi = min(mi, tmp)
  
print(mi)