from sys import setrecursionlimit as lim
lim(10**8)

INF = int(1e20)

def solve(s, l):
    if s == []: return 0
    n = len(l)
    a = s[0]
    ss = s[1:]
    ret = INF
    if n == 0: return INF
    else:
        ll = []
        for bit in xrange(1, 1 << n):
            st = ans = 0
            for j in xrange(n):
                if (bit & (1 << j)):
                    st += l[j]
                    ans += 10
                else:
                    ll.append(l[j])
            ans -= 10
            ans += abs(a - st)
            if n > 1:
                ans = ans + solve(ss, ll)
            ret = min(ret, ans)

    return ret

n, a, b, c = map(int, raw_input().strip().split())
l = [0 for i in xrange(n)]
for i in xrange(n): l[i] = input()

ans = solve([a, b, c], l)
ans = min(ans, solve([a, c, b], l))
ans = min(ans, solve([b, a, c], l))
ans = min(ans, solve([b, c, a], l))
ans = min(ans, solve([c, a, b], l))
ans = min(ans, solve([c, b, a], l))


