N, A, B, C = map(int, input().split())
abc = [C, B, A]

l = [0] * N
for i in range(N):
    l[i] = int(input())

import numpy
mpp = 10**10
L = [0] * 3
t = [-10] * 3

for i in range(1, 4**N):
    b = numpy.base_repr(i, 4, N)[-N:]
    L = [A, B, C]
    t = [-10] * 3
    if "1" not in b or "2" not in b or "3" not in b:
        continue
    #print(b)
    for j in range(N):
        for k in range(3):
            if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
    mpp = min(mpp, sum(t) + sum([abs(x) for x in L]))

print(mpp)
 N, A, B, C = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split A B C abc = [C, B, A] abc [C, B, A] C B A l = [0] * N l [0] * N [0] 0 N for i in range(N):
    l[i] = int(input()) i range(N) range N l[i] = int(input()) l[i] l i int(input()) int input() input import numpy numpy mpp = 10**10 mpp 10**10 10 10 L = [0] * 3 L [0] * 3 [0] 0 3 t = [-10] * 3 t [-10] * 3 [-10] -10 3 for i in range(1, 4**N):
    b = numpy.base_repr(i, 4, N)[-N:]
    L = [A, B, C]
    t = [-10] * 3
    if "1" not in b or "2" not in b or "3" not in b:
        continue
    #print(b)
    for j in range(N):
        for k in range(3):
            if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
    mpp = min(mpp, sum(t) + sum([abs(x) for x in L])) i range(1, 4**N) range 1 4**N 4 N b = numpy.base_repr(i, 4, N)[-N:] b numpy.base_repr(i, 4, N)[-N:] numpy.base_repr(i, 4, N) numpy.base_repr numpy base_repr i 4 N -N: -N N L = [A, B, C] L [A, B, C] A B C t = [-10] * 3 t [-10] * 3 [-10] -10 3 if "1" not in b or "2" not in b or "3" not in b:
        continue
    #print(b)
     "1" not in b or "2" not in b or "3" not in b "1" not in b or "2" not in b "1" not in b "1" b "2" not in b "2" b "3" not in b "3" b continue for j in range(N):
        for k in range(3):
            if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
     j range(N) range N for k in range(3):
            if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
     k range(3) range 3 if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
     b[j] == str(k + 1) b[j] b j str(k + 1) str k + 1 k 1 L[k] -= l[j] L[k] L k l[j] l j t[k] += 10 t[k] t k 10 abs(x) for x in L for x in L x L for x in L abs(x) abs x mpp = min(mpp, sum(t) + sum([abs(x) for x in L])) mpp min(mpp, sum(t) + sum([abs(x) for x in L])) min mpp sum(t) + sum([abs(x) for x in L]) sum(t) sum t sum([abs(x) for x in L]) sum [abs(x) for x in L] print(mpp) print mpp t = [-10] * 3 [-10] * 3 t l = [0] * N [0] * N l L = [A, B, C] [A, B, C] L N, A, B, C = map(int, input().split()) map(int, input().split()) N C = map(int, input().split()) map(int, input().split()) C mpp = 10**10 10**10 mpp b = numpy.base_repr(i, 4, N)[-N:] numpy.base_repr(i, 4, N)[-N:] b B, C = map(int, input().split()) map(int, input().split()) B mpp = min(mpp, sum(t) + sum([abs(x) for x in L])) min(mpp, sum(t) + sum([abs(x) for x in L])) mpp A, B, C = map(int, input().split()) map(int, input().split()) A L = [0] * 3 [0] * 3 L abc = [C, B, A] [C, B, A] abc t = [-10] * 3 [-10] * 3 t
N, A, B, C = map(int, input().split())
abc = [C, B, A]

l = [0] * N
for i in range(N):
    l[i] = int(input())

import numpy
mpp = 10**10
L = [0] * 3
t = [-10] * 3

for i in range(1, 4**N):
    b = numpy.base_repr(i, 4, N)[-N:]
    L = [A, B, C]
    t = [-10] * 3
    if "1" not in b or "2" not in b or "3" not in b:
        continue
    #print(b)
    for j in range(N):
        for k in range(3):
            if b[j] == str(k + 1):
                L[k] -= l[j]
                t[k] += 10
    mpp = min(mpp, sum(t) + sum([abs(x) for x in L]))

print(mpp)

