n,a,b,c = map(int, input().split())
a,b,c = sorted([a,b,c])
l = [int(input()) for i in range(n)]
ans = 10 ** 18
for i in range(4 ** n):
  LEN = [0,0,0,0]
  num = [0,0,0,0]
  for j,v in enumerate(l):
    index = (i >> (j * 2)) & 3
    LEN[index] += v
    num[index] += 1
  if num[0] and num[1] and num[2]:
    mp = (sum(num[:3])-3) * 10
    d = sorted(LEN[:3])
    mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c)
    ans = min(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 a,b,c = sorted([a,b,c]) a sorted([a,b,c]) sorted [a,b,c] a b c 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 ** 18 ans 10 ** 18 10 18 for i in range(4 ** n):
  LEN = [0,0,0,0]
  num = [0,0,0,0]
  for j,v in enumerate(l):
    index = (i >> (j * 2)) & 3
    LEN[index] += v
    num[index] += 1
  if num[0] and num[1] and num[2]:
    mp = (sum(num[:3])-3) * 10
    d = sorted(LEN[:3])
    mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c)
    ans = min(ans, mp) i range(4 ** n) range 4 ** n 4 n LEN = [0,0,0,0] LEN [0,0,0,0] 0 0 0 0 num = [0,0,0,0] num [0,0,0,0] 0 0 0 0 for j,v in enumerate(l):
    index = (i >> (j * 2)) & 3
    LEN[index] += v
    num[index] += 1
   j v enumerate(l) enumerate l index = (i >> (j * 2)) & 3 index (i >> (j * 2)) & 3 i >> (j * 2) i j * 2 j 2 3 LEN[index] += v LEN[index] LEN index v num[index] += 1 num[index] num index 1 if num[0] and num[1] and num[2]:
    mp = (sum(num[:3])-3) * 10
    d = sorted(LEN[:3])
    mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c)
    ans = min(ans, mp) num[0] and num[1] and num[2] num[0] and num[1] num[0] num 0 num[1] num 1 num[2] num 2 mp = (sum(num[:3])-3) * 10 mp (sum(num[:3])-3) * 10 sum(num[:3])-3 sum(num[:3]) sum num[:3] num :3 3 3 10 d = sorted(LEN[:3]) d sorted(LEN[:3]) sorted LEN[:3] LEN :3 3 mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c) mp abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c) abs(d[0]-a) + abs(d[1]-b) abs(d[0]-a) abs d[0]-a d[0] d 0 a abs(d[1]-b) abs d[1]-b d[1] d 1 b abs(d[2]-c) abs d[2]-c d[2] d 2 c ans = min(ans, mp) ans min(ans, mp) min ans mp print(ans) print ans num = [0,0,0,0] [0,0,0,0] num c = sorted([a,b,c]) sorted([a,b,c]) c a,b,c = sorted([a,b,c]) sorted([a,b,c]) a d = sorted(LEN[:3]) sorted(LEN[:3]) d l = [int(input()) for i in range(n)] [int(input()) for i in range(n)] l mp = (sum(num[:3])-3) * 10 (sum(num[:3])-3) * 10 mp mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c) abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c) mp c = map(int, input().split()) map(int, input().split()) c LEN = [0,0,0,0] [0,0,0,0] LEN index = (i >> (j * 2)) & 3 (i >> (j * 2)) & 3 index ans = min(ans, mp) min(ans, mp) ans n,a,b,c = map(int, input().split()) map(int, input().split()) n a,b,c = map(int, input().split()) map(int, input().split()) a ans = 10 ** 18 10 ** 18 ans b,c = sorted([a,b,c]) sorted([a,b,c]) b b,c = map(int, input().split()) map(int, input().split()) b
n,a,b,c = map(int, input().split())
a,b,c = sorted([a,b,c])
l = [int(input()) for i in range(n)]
ans = 10 ** 18
for i in range(4 ** n):
  LEN = [0,0,0,0]
  num = [0,0,0,0]
  for j,v in enumerate(l):
    index = (i >> (j * 2)) & 3
    LEN[index] += v
    num[index] += 1
  if num[0] and num[1] and num[2]:
    mp = (sum(num[:3])-3) * 10
    d = sorted(LEN[:3])
    mp += abs(d[0]-a) + abs(d[1]-b) + abs(d[2]-c)
    ans = min(ans, mp)
print(ans)