N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]
def f(X):
  global N,A,B,C,L
  if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
  return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10)

print(f([])-30) 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)] def f(X):
  global N,A,B,C,L
  if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
  return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10) f global N,A,B,C,L if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
   len(X)==N len(X) len X N a,b,c=0,0,0 a 0 b 0 c 0 for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
     i range(N) range N a+=X[i][0] a X[i][0] [i] X i 0 b+=X[i][1] b X[i][1] [i] X i 1 c+=X[i][2] c X[i][2] [i] X i 2 if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
   min(a,b,c)==0 min(a,b,c) min a b c 0 return 10**16 10**16 10 16 return abs(A-a)+abs(B-b)+abs(C-c) abs(A-a)+abs(B-b)+abs(C-c) abs(A-a)+abs(B-b) abs(A-a) abs A-a A a abs(B-b) abs B-b B b abs(C-c) abs C-c C c return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10) min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10) min f(X+[[0,0,0]]) f X+[[0,0,0]] X [[0,0,0]] [0,0,0] 0 0 0 f(X+[[L[len(X)],0,0]])+10 f(X+[[L[len(X)],0,0]]) f X+[[L[len(X)],0,0]] X [[L[len(X)],0,0]] [L[len(X)],0,0] L[len(X)] L len(X) len X 0 0 10 f(X+[[0,L[len(X)],0]])+10 f(X+[[0,L[len(X)],0]]) f X+[[0,L[len(X)],0]] X [[0,L[len(X)],0]] [0,L[len(X)],0] 0 L[len(X)] L len(X) len X 0 10 f(X+[[0,0,L[len(X)]]])+10 f(X+[[0,0,L[len(X)]]]) f X+[[0,0,L[len(X)]]] X [[0,0,L[len(X)]]] [0,0,L[len(X)]] 0 0 L[len(X)] L len(X) len X 10 X X print(f([])-30) print f([])-30 f([]) f [] 30 B,C=map(int,input().split()) map(int,input().split()) B def f(X):
  global N,A,B,C,L
  if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
  return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10) def f(X):
  global N,A,B,C,L
  if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
  return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10) f L=[int(input()) for i in range(N)] [int(input()) for i in range(N)] L 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 C=map(int,input().split()) map(int,input().split()) C
N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]
def f(X):
  global N,A,B,C,L
  if len(X)==N:
    a,b,c=0,0,0
    for i in range(N):
      a+=X[i][0]
      b+=X[i][1]
      c+=X[i][2]
    if min(a,b,c)==0:
      return 10**16
    else:
      return abs(A-a)+abs(B-b)+abs(C-c)
  return min(f(X+[[0,0,0]]),f(X+[[L[len(X)],0,0]])+10,f(X+[[0,L[len(X)],0]])+10,f(X+[[0,0,L[len(X)]]])+10)

print(f([])-30)