# -*- coding: utf-8 -*-
import numpy as np

def get_nearest_idx(l, i):
    idx = np.searchsorted(np.array(l), i, side='right')

    return idx

n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
l.sort()

c -= l.pop(get_nearest_idx(l, c))
b -= l.pop(get_nearest_idx(l, b))
a -= l.pop(get_nearest_idx(l, a))

mp = 0
for i in [c, b, a]:
    while abs(i) < 10:
        idx = get_nearest_idx(l, i)
        nearest = l[idx]
        if abs(i) < abs(i - nearest):
            break
        else:
            i -= l.pop(idx)
    mp += i

print(mp)
