import numpy as np
def solve(l, a, b, c):
    n = len(l)
    best = 10**10
    for mask in range(4**n):
        v = np.zeros(4, np.int)
        w = np.zeros(4, np.int)
        num = 0
        for i in range(n):
            j = mask % 4
            mask //= 4
            v[j] += 1
            w[j] += l[i]
        if (v[0] > 0) and (v[1] > 0) and (v[2] > 0):
            cur = 10 * (sum(v[:3]) - 3) + np.sum(np.abs(w[:3]-[a,b,c]))
            best = min(best, cur)
    return best
n, a, b, c = map(int, input().split())
l = [int(input()) for i in range(n)]
print(solve(l, a, b, c))