import numpy as np

n, a, b, c = map(int, input().split(' '))
ls = []
for _ in range(n):
    ls.append(int(input()))
n = 0


def solve(obj):
    c = len(ls)
    dp = np.zeros((obj + 1, c + 1), dtype=int)
    dp[1:, 0] = 10000
    for j in range(1, c + 1):
        dp[0, j] = min(ls[:j])
    for i in range(1, obj + 1):
        for j in range(1, c + 1):
            dp[i, j] = min(dp[i - 1, j] + 1, dp[i, j - 1], abs(ls[j - 1] - i))
            if i >= ls[j - 1]:
                dp[i, j] = min(dp[i, j], dp[i - ls[j - 1], j - 1] + 10)
  
    return dp[obj, c]


for obj in [a, b, c]:
    if obj in ls:
        continue
    else:
        n += solve(obj)
print(n)