n,*a=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=float("inf")
for i in range(4**n):
  table=[0 for g in range(3) ]
  temp=i
  pre=0

  for j in range(n):

    if temp%4==3:temp//=4;continue
    if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
    temp//=4
  if 0 in table:continue
  for g in range(3):
    pre+=abs(a[g]-table[g])
  ans=min(ans,pre)
print(ans) n,*a=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split *a a 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=float("inf") ans float("inf") float "inf" for i in range(4**n):
  table=[0 for g in range(3) ]
  temp=i
  pre=0

  for j in range(n):

    if temp%4==3:temp//=4;continue
    if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
    temp//=4
  if 0 in table:continue
  for g in range(3):
    pre+=abs(a[g]-table[g])
  ans=min(ans,pre) i range(4**n) range 4**n 4 n 0 for g in range(3) for g in range(3) g range(3) range 3 for g in range(3) 0 table=[0 for g in range(3) ] table [0 for g in range(3) ] temp=i temp i pre=0 pre 0 for j in range(n):

    if temp%4==3:temp//=4;continue
    if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
    temp//=4
   j range(n) range n if temp%4==3:temp//=4;continue
     temp%4==3 temp%4 temp 4 3 if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
     table[temp%4] table temp%4 temp 4 table[temp%4]+=l[j] table[temp%4] table temp%4 temp 4 l[j] l j pre+=10 pre 10 temp//=4 temp 4 if 0 in table:continue
   0 in table 0 table for g in range(3):
    pre+=abs(a[g]-table[g])
   g range(3) range 3 pre+=abs(a[g]-table[g]) pre abs(a[g]-table[g]) abs a[g]-table[g] a[g] a g table[g] table g ans=min(ans,pre) ans min(ans,pre) min ans pre print(ans) print ans l=[int(input()) for i in range(n)] [int(input()) for i in range(n)] l n,*a=map(int,input().split()) map(int,input().split()) n pre+=10 10 pre pre+=abs(a[g]-table[g]) abs(a[g]-table[g]) pre ans=float("inf") float("inf") ans table=[0 for g in range(3) ] [0 for g in range(3) ] table ans=min(ans,pre) min(ans,pre) ans temp=i i temp temp//=4 4 temp pre=0 0 pre
n,*a=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=float("inf")
for i in range(4**n):
  table=[0 for g in range(3) ]
  temp=i
  pre=0

  for j in range(n):

    if temp%4==3:temp//=4;continue
    if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
    temp//=4
  if 0 in table:continue
  for g in range(3):
    pre+=abs(a[g]-table[g])
  ans=min(ans,pre)
print(ans)