N,A,B,C=map(int,input().split())
X=[0,A,B,C]
L=[int(input()) for i in range(N)]
d=4**N
ans=float('inf')

for i in range(d):
  F=[0 for i in range(4)]
  cnt=[0 for i in range(4)]
  for j in range(N):
    F[i%4]+=L[j]
    cnt[i%4]+=1
    i //= 4
  p=True
  for k in range(1,4):
    if F[k]==0:
      p=False
      break
  tmp=0
  if p:
    for k in range(1,4):
      tmp+=cnt[k]*10+abs(X[k]-F[k])-10
    ans=min(ans,tmp)
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 X=[0,A,B,C] X [0,A,B,C] 0 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)] d=4**N d 4**N 4 N ans=float('inf') ans float('inf') float 'inf' for i in range(d):
  F=[0 for i in range(4)]
  cnt=[0 for i in range(4)]
  for j in range(N):
    F[i%4]+=L[j]
    cnt[i%4]+=1
    i //= 4
  p=True
  for k in range(1,4):
    if F[k]==0:
      p=False
      break
  tmp=0
  if p:
    for k in range(1,4):
      tmp+=cnt[k]*10+abs(X[k]-F[k])-10
    ans=min(ans,tmp) i range(d) range d 0 for i in range(4) for i in range(4) i range(4) range 4 for i in range(4) 0 F=[0 for i in range(4)] F [0 for i in range(4)] 0 for i in range(4) for i in range(4) i range(4) range 4 for i in range(4) 0 cnt=[0 for i in range(4)] cnt [0 for i in range(4)] for j in range(N):
    F[i%4]+=L[j]
    cnt[i%4]+=1
    i //= 4
   j range(N) range N F[i%4]+=L[j] F[i%4] F i%4 i 4 L[j] L j cnt[i%4]+=1 cnt[i%4] cnt i%4 i 4 1 i //= 4 i 4 p=True p True for k in range(1,4):
    if F[k]==0:
      p=False
      break
   k range(1,4) range 1 4 if F[k]==0:
      p=False
      break
   F[k]==0 F[k] F k 0 p=False p False break tmp=0 tmp 0 if p:
    for k in range(1,4):
      tmp+=cnt[k]*10+abs(X[k]-F[k])-10
    ans=min(ans,tmp) p for k in range(1,4):
      tmp+=cnt[k]*10+abs(X[k]-F[k])-10
     k range(1,4) range 1 4 tmp+=cnt[k]*10+abs(X[k]-F[k])-10 tmp cnt[k]*10+abs(X[k]-F[k])-10 cnt[k]*10+abs(X[k]-F[k]) cnt[k]*10 cnt[k] cnt k 10 abs(X[k]-F[k]) abs X[k]-F[k] X[k] X k F[k] F k 10 ans=min(ans,tmp) ans min(ans,tmp) min ans tmp print(ans) print ans ans=float('inf') float('inf') ans p=True True p ans=min(ans,tmp) min(ans,tmp) ans p=False False p F=[0 for i in range(4)] [0 for i in range(4)] F B,C=map(int,input().split()) map(int,input().split()) B N,A,B,C=map(int,input().split()) map(int,input().split()) N cnt=[0 for i in range(4)] [0 for i in range(4)] cnt C=map(int,input().split()) map(int,input().split()) C A,B,C=map(int,input().split()) map(int,input().split()) A X=[0,A,B,C] [0,A,B,C] X tmp=0 0 tmp tmp+=cnt[k]*10+abs(X[k]-F[k])-10 cnt[k]*10+abs(X[k]-F[k])-10 tmp d=4**N 4**N d i //= 4 4 i L=[int(input()) for i in range(N)] [int(input()) for i in range(N)] L
N,A,B,C=map(int,input().split())
X=[0,A,B,C]
L=[int(input()) for i in range(N)]
d=4**N
ans=float('inf')

for i in range(d):
  F=[0 for i in range(4)]
  cnt=[0 for i in range(4)]
  for j in range(N):
    F[i%4]+=L[j]
    cnt[i%4]+=1
    i //= 4
  p=True
  for k in range(1,4):
    if F[k]==0:
      p=False
      break
  tmp=0
  if p:
    for k in range(1,4):
      tmp+=cnt[k]*10+abs(X[k]-F[k])-10
    ans=min(ans,tmp)
print(ans)