import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans)

if __name__ == '__main__':
    resolve() import bisect, collections, copy, heapq, itertools, math, string, sys bisect collections copy heapq itertools math string sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = float('inf') INF float('inf') float 'inf' def I(): return int(input()) I def F(): return float(input()) F def SS(): return input() SS int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x def LI(): return [int(x) for x in input().split()] LI int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in input().split()] LI_ float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() LSS def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans) resolve N, A, B, C = LI() N LI() LI A B C ABC = (A, B, C) ABC (A, B, C) A B C I() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) I() I l = [I() for _ in range(N)] l [I() for _ in range(N)] ans = INF ans INF for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

     i itertools.product(range(4), repeat=N) itertools.product itertools product range(4) range 4 repeat=N repeat N a_cnt = i.count(0) a_cnt i.count(0) i.count i count 0 b_cnt = i.count(1) b_cnt i.count(1) i.count i count 1 c_cnt = i.count(2) c_cnt i.count(2) i.count i count 2 if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

     a_cnt > 0 and b_cnt > 0 and c_cnt > 0 a_cnt > 0 and b_cnt > 0 a_cnt > 0 a_cnt 0 b_cnt > 0 b_cnt 0 c_cnt > 0 c_cnt 0 mp = 10 * (a_cnt + b_cnt + c_cnt - 3) mp 10 * (a_cnt + b_cnt + c_cnt - 3) 10 a_cnt + b_cnt + c_cnt - 3 a_cnt + b_cnt + c_cnt a_cnt + b_cnt a_cnt b_cnt c_cnt 3 len = [0] * 3 len [0] * 3 [0] 0 3 for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
             j range(N) range N if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
             0 <= i[j] < 3 0 <= i[j] 0 i[j] i j 3 len[i[j]] += l[j] len[i[j]] len i[j] i j l[j] l j abs(j - k) for j, k in zip(ABC, len) for j, k in zip(ABC, len) j k zip(ABC, len) zip ABC len for j, k in zip(ABC, len) abs(j - k) abs j - k j k mp += sum([abs(j - k) for j, k in zip(ABC, len)]) mp sum([abs(j - k) for j, k in zip(ABC, len)]) sum [abs(j - k) for j, k in zip(ABC, len)] ans = min(mp, ans) ans min(mp, ans) min mp ans print(ans) print ans if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def F(): return float(input()) def F(): return float(input()) F def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans) def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans) resolve def LI_(): return [int(x)-1 for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] LI_ def I(): return int(input()) def I(): return int(input()) I INF = float('inf') float('inf') INF def SS(): return input() def SS(): return input() SS def LI(): return [int(x) for x in input().split()] def LI(): return [int(x) for x in input().split()] LI def LF(): return [float(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() def LSS(): return input().split() LSS
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans)

if __name__ == '__main__':
    resolve()
