# coding:utf-8



import sys

import itertools



INF = float('inf')

MOD = 10 ** 9 + 7



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())





n, a, b, c = LI()

A = [a, b, c]

K = [II() for _ in range(n)]



ans = INF

for x in itertools.product([0, 1, 2, 3], repeat=n):

    s = set(x)

    if 0 not in s or 1 not in s or 2 not in s:

        continue

    T = [0] * 3

    cnt = 0

    for i, n in enumerate(x):

        if n == 3:

            continue

        if T[n]:

            cnt += 1

        T[n] += K[i]



    # print(T, cnt)

    tmp = cnt * 10

    for i in range(3):

        tmp += abs(T[i] - A[i])



    ans = min(ans, tmp)



print(ans)

# coding:utf-8



import sys



INF = float('inf')

MOD = 10 ** 9 + 7



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())





n, a, b, c = LI()

A = [a, b, c]

K = [II() for _ in range(n)]





def DFS(cur, x, y, z):

    if cur == n:

        return abs(x - a) + abs(y - b) + abs(z - c) - 30 if min(x, y, z) > 0 else INF

    ret0 = DFS(cur + 1, x, y, z)

    ret1 = DFS(cur + 1, x + K[cur], y, z) + 10

    ret2 = DFS(cur + 1, x, y + K[cur], z) + 10

    ret3 = DFS(cur + 1, x, y, z + K[cur]) + 10

    return min(ret0, ret1, ret2, ret3)





print((DFS(0, 0, 0, 0)))

# coding:utf-8
import sys
import itertools

INF = float("inf")
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


n, a, b, c = LI()
A = [a, b, c]
K = [II() for _ in range(n)]
ans = INF
for x in itertools.product([0, 1, 2, 3], repeat=n):
    s = set(x)
    if 0 not in s or 1 not in s or 2 not in s:
        continue
    T = [0] * 3
    cnt = 0
    for i, n in enumerate(x):
        if n == 3:
            continue
        if T[n]:
            cnt += 1
        T[n] += K[i]
    # print(T, cnt)
    tmp = cnt * 10
    for i in range(3):
        tmp += abs(T[i] - A[i])
    ans = min(ans, tmp)
print(ans)

# coding:utf-8
import sys

INF = float("inf")
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


n, a, b, c = LI()
A = [a, b, c]
K = [II() for _ in range(n)]


def DFS(cur, x, y, z):
    if cur == n:
        return abs(x - a) + abs(y - b) + abs(z - c) - 30 if min(x, y, z) > 0 else INF
    ret0 = DFS(cur + 1, x, y, z)
    ret1 = DFS(cur + 1, x + K[cur], y, z) + 10
    ret2 = DFS(cur + 1, x, y + K[cur], z) + 10
    ret3 = DFS(cur + 1, x, y, z + K[cur]) + 10
    return min(ret0, ret1, ret2, ret3)


print((DFS(0, 0, 0, 0)))

-import itertools -ans = INF -for x in itertools.product([0, 1, 2, 3], repeat=n): -    s = set(x) -    if 0 not in s or 1 not in s or 2 not in s: -        continue -    T = [0] * 3 -    cnt = 0 -    for i, n in enumerate(x): -        if n == 3: -            continue -        if T[n]: -            cnt += 1 -        T[n] += K[i] -    # print(T, cnt) -    tmp = cnt * 10 -    for i in range(3): -        tmp += abs(T[i] - A[i]) -    ans = min(ans, tmp) -print(ans) + + +def DFS(cur, x, y, z): +    if cur == n: +        return abs(x - a) + abs(y - b) + abs(z - c) - 30 if min(x, y, z) > 0 else INF +    ret0 = DFS(cur + 1, x, y, z) +    ret1 = DFS(cur + 1, x + K[cur], y, z) + 10 +    ret2 = DFS(cur + 1, x, y + K[cur], z) + 10 +    ret3 = DFS(cur + 1, x, y, z + K[cur]) + 10 +    return min(ret0, ret1, ret2, ret3) + + +print((DFS(0, 0, 0, 0)))