import os
import math
from itertools import permutations
import functools as func
INF, MOD = float("inf"), 1e9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

while(True):
    try:
        n, a, b, c = get_int_list()
        l = [get_int() for _ in range(n)]
        ans = 1000000000000
        for take in permutations(l, n):
            take = list(take)
            cnt = 0
            i = 3
            while abs(take[0] - a) > 10:
                if i >= n:
                    break
                take[0] += take[i]
                i += 1
                cnt += 10
            cnt += abs(take[0] - a)

            while abs(take[1] - b) > 10:
                if i >= n:
                    break
                take[1] += take[i]
                i += 1
                cnt += 10
            cnt += abs(take[1] - b)

            while abs(take[2] - c) > 10:
                if i >= n:
                    break
                take[2] += take[i]
                i += 1
                cnt += 10
            cnt += abs(take[2] - c)

            ans = min(ans, cnt)
        print(ans)
    except EOFError:
        exit()
