N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
def rec(i, a, b, c, d):
    if i == N:
        if a == 0 or b == 0 or c == 0:
            return float('inf')
        return abs(a-A)+abs(b-B)+abs(c-C)+d
    return min(rec(i+1,a+l[i],b,c,d+10),rec(i+1,a,b+l[i],c,d+10),rec(i+1,a,b,c+l[i],d+10),rec(i+1,a,b,c,d))
print(rec(0,0,0,0,-30))
