import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, A, B, C = MAP()

l = [INT() for _ in range(N)]

ans = INF
for x in product(range(4), repeat=N):
	tmp = 0
	bamboo = [0]*4 #[不使用、Aに使用、Bに使用、Cに使用]
	for i in range(N):
		if 0 < x[i] and bamboo[x[i]]:
			tmp += 10
		bamboo[x[i]] += l[i]

	if 0 in bamboo[1:]:
		continue

	tmp += abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C)

	ans = min(ans, tmp)

print(ans)
 import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left, insort, insort_left from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST def TUPLE(): return tuple(map(int, input().split())) TUPLE MAP() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) MAP() MAP def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP n n sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 from decimal import * N, A, B, C = MAP() N MAP() MAP A B C INT() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) INT() INT l = [INT() for _ in range(N)] l [INT() for _ in range(N)] ans = INF ans INF for x in product(range(4), repeat=N):
	tmp = 0
	bamboo = [0]*4 #[不使用、Aに使用、Bに使用、Cに使用]
	for i in range(N):
		if 0 < x[i] and bamboo[x[i]]:
			tmp += 10
		bamboo[x[i]] += l[i]

	if 0 in bamboo[1:]:
		continue

	tmp += abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C)

	ans = min(ans, tmp) x product(range(4), repeat=N) product range(4) range 4 repeat=N repeat N tmp = 0 tmp 0 bamboo = [0]*4 bamboo [0]*4 [0] 0 4 for i in range(N):
		if 0 < x[i] and bamboo[x[i]]:
			tmp += 10
		bamboo[x[i]] += l[i]

	 i range(N) range N if 0 < x[i] and bamboo[x[i]]:
			tmp += 10
		 0 < x[i] and bamboo[x[i]] 0 < x[i] 0 x[i] x i bamboo[x[i]] bamboo x[i] x i tmp += 10 tmp 10 bamboo[x[i]] += l[i] bamboo[x[i]] bamboo x[i] x i l[i] l i if 0 in bamboo[1:]:
		continue

	 0 in bamboo[1:] 0 bamboo[1:] bamboo 1: 1 continue tmp += abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C) tmp abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C) abs(bamboo[1]-A) + abs(bamboo[2]-B) abs(bamboo[1]-A) abs bamboo[1]-A bamboo[1] bamboo 1 A abs(bamboo[2]-B) abs bamboo[2]-B bamboo[2] bamboo 2 B abs(bamboo[3]-C) abs bamboo[3]-C bamboo[3] bamboo 3 C ans = min(ans, tmp) ans min(ans, tmp) min ans tmp print(ans) print ans C = MAP() MAP() C INF = float('inf') float('inf') INF tmp = 0 0 tmp ans = min(ans, tmp) min(ans, tmp) ans tmp += 10 10 tmp def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP l = [INT() for _ in range(N)] [INT() for _ in range(N)] l mod = 10 ** 9 + 7 10 ** 9 + 7 mod tmp += abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C) abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C) tmp def TUPLE(): return tuple(map(int, input().split())) def TUPLE(): return tuple(map(int, input().split())) TUPLE A, B, C = MAP() MAP() A ans = INF INF ans def ZIP(n): return zip(*(MAP() for _ in range(n))) def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP N, A, B, C = MAP() MAP() N def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST def INT(): return int(input()) def INT(): return int(input()) INT B, C = MAP() MAP() B bamboo = [0]*4 [0]*4 bamboo
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, A, B, C = MAP()

l = [INT() for _ in range(N)]

ans = INF
for x in product(range(4), repeat=N):
	tmp = 0
	bamboo = [0]*4 #[不使用、Aに使用、Bに使用、Cに使用]
	for i in range(N):
		if 0 < x[i] and bamboo[x[i]]:
			tmp += 10
		bamboo[x[i]] += l[i]

	if 0 in bamboo[1:]:
		continue

	tmp += abs(bamboo[1]-A) + abs(bamboo[2]-B) + abs(bamboo[3]-C)

	ans = min(ans, tmp)

print(ans)

