from itertools import combinations
n, a, b, c = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))
ans = 10**6
f = lambda li, k: abs(sum(li)-k)+10*(len(li)-1)
for i in range(4**n):
    li = [[] for _ in range(4)]
    for j in range(n):
        li[(i//(4**j))%4].append(l[j])
    if len(li[0])*len(li[1])*len(li[2])==0:
        continue
    ans = min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c))
print(ans) from itertools import combinations n, a, b, c = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split a b c l = [] l [] for i in range(n):
    l.append(int(input())) i range(n) range n l.append(int(input())) l.append l append int(input()) int input() input ans = 10**6 ans 10**6 10 6 f = lambda li, k: abs(sum(li)-k)+10*(len(li)-1) f lambda li, k: abs(sum(li)-k)+10*(len(li)-1) abs(sum(li)-k)+10*(len(li)-1) abs(sum(li)-k) abs sum(li)-k sum(li) sum li k 10*(len(li)-1) 10 len(li)-1 len(li) len li 1 li k for i in range(4**n):
    li = [[] for _ in range(4)]
    for j in range(n):
        li[(i//(4**j))%4].append(l[j])
    if len(li[0])*len(li[1])*len(li[2])==0:
        continue
    ans = min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c)) i range(4**n) range 4**n 4 n [] for _ in range(4) for _ in range(4) _ range(4) range 4 for _ in range(4) [] li = [[] for _ in range(4)] li [[] for _ in range(4)] for j in range(n):
        li[(i//(4**j))%4].append(l[j])
     j range(n) range n li[(i//(4**j))%4].append(l[j]) [(i//(4**j))%4].append [(i//(4**j))%4] li (i//(4**j))%4 i//(4**j) i 4**j 4 j 4 append l[j] l j if len(li[0])*len(li[1])*len(li[2])==0:
        continue
     len(li[0])*len(li[1])*len(li[2])==0 len(li[0])*len(li[1])*len(li[2]) len(li[0])*len(li[1]) len(li[0]) len li[0] li 0 len(li[1]) len li[1] li 1 len(li[2]) len li[2] li 2 0 continue ans = min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c)) ans min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c)) min ans f(li[0], a)+f(li[1], b)+f(li[2], c) f(li[0], a)+f(li[1], b) f(li[0], a) f li[0] li 0 a f(li[1], b) f li[1] li 1 b f(li[2], c) f li[2] li 2 c print(ans) print ans l = [] [] l c = map(int, input().split()) map(int, input().split()) c f = lambda li, k: abs(sum(li)-k)+10*(len(li)-1) lambda li, k: abs(sum(li)-k)+10*(len(li)-1) f ans = 10**6 10**6 ans n, a, b, c = map(int, input().split()) map(int, input().split()) n b, c = map(int, input().split()) map(int, input().split()) b ans = min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c)) min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c)) ans a, b, c = map(int, input().split()) map(int, input().split()) a li = [[] for _ in range(4)] [[] for _ in range(4)] li
from itertools import combinations
n, a, b, c = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))
ans = 10**6
f = lambda li, k: abs(sum(li)-k)+10*(len(li)-1)
for i in range(4**n):
    li = [[] for _ in range(4)]
    for j in range(n):
        li[(i//(4**j))%4].append(l[j])
    if len(li[0])*len(li[1])*len(li[2])==0:
        continue
    ans = min(ans, f(li[0], a)+f(li[1], b)+f(li[2], c))
print(ans)