N, A, B, C = map(int, input().split())
2 l = [int(input()) for i in range(N)]
3 INF = 10 ** 9
4
5 def dfs(cur, a, b, c, MP):
6 if cur == N:
7 return abs(a - A) + abs(b - B) + abs(c - C) + MP if min(a, b, c) > 0 else INF
8 ret0 = dfs(cur + 1, a, b, c, MP)
9 ret1 = dfs(cur + 1, a + l[cur], b, c, MP + 10)
10 ret2 = dfs(cur + 1, a, b + l[cur], c, MP + 10)
11 ret3 = dfs(cur + 1, a, b, c + l[cur], MP + 10)
12 return min(ret0, ret1, ret2, ret3)
13
14 print(dfs(0, 0, 0, 0))
