N, A, B, C = map(int, input().split())
L_list = [int(input()) for i in range(N)]

INF = 10 ** 9

def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4)


ans = dfs(0, 0, 0, 0)
print(ans)
'''
8 100 90 80
100
100
90
90
90
80
80
80

0


8 1000 800 100
300
333
400
444
500
555
600
666

243

''' N, A, B, C = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split A B C int(input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(input()) int input() input L_list = [int(input()) for i in range(N)] L_list [int(input()) for i in range(N)] INF = 10 ** 9 INF 10 ** 9 10 9 def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4) dfs if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

     n == N n N return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF min(a, b, c) > 0 min(a, b, c) min a b c 0 abs(A - a) + abs(B - b) + abs(C - c) - 30 abs(A - a) + abs(B - b) + abs(C - c) abs(A - a) + abs(B - b) abs(A - a) abs A - a A a abs(B - b) abs B - b B b abs(C - c) abs C - c C c 30 INF ret1 = dfs(a, b, c, n + 1) ret1 dfs(a, b, c, n + 1) dfs a b c n + 1 n 1 ret2 = dfs(a + L_list[n], b, c, n + 1) + 10 ret2 dfs(a + L_list[n], b, c, n + 1) + 10 dfs(a + L_list[n], b, c, n + 1) dfs a + L_list[n] a L_list[n] L_list n b c n + 1 n 1 10 ret3 = dfs(a, b + L_list[n], c, n + 1) + 10 ret3 dfs(a, b + L_list[n], c, n + 1) + 10 dfs(a, b + L_list[n], c, n + 1) dfs a b + L_list[n] b L_list[n] L_list n c n + 1 n 1 10 ret4 = dfs(a, b, c + L_list[n], n + 1) + 10 ret4 dfs(a, b, c + L_list[n], n + 1) + 10 dfs(a, b, c + L_list[n], n + 1) dfs a b c + L_list[n] c L_list[n] L_list n n + 1 n 1 10 return min(ret1, ret2, ret3, ret4) min(ret1, ret2, ret3, ret4) min ret1 ret2 ret3 ret4 a a b b c c n n ans = dfs(0, 0, 0, 0) ans dfs(0, 0, 0, 0) dfs 0 0 0 0 print(ans) print ans '''
8 100 90 80
100
100
90
90
90
80
80
80

0


8 1000 800 100
300
333
400
444
500
555
600
666

243

''' def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4) def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4) dfs B, C = map(int, input().split()) map(int, input().split()) B ans = dfs(0, 0, 0, 0) dfs(0, 0, 0, 0) ans N, A, B, C = map(int, input().split()) map(int, input().split()) N C = map(int, input().split()) map(int, input().split()) C INF = 10 ** 9 10 ** 9 INF L_list = [int(input()) for i in range(N)] [int(input()) for i in range(N)] L_list A, B, C = map(int, input().split()) map(int, input().split()) A
N, A, B, C = map(int, input().split())
L_list = [int(input()) for i in range(N)]

INF = 10 ** 9

def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4)


ans = dfs(0, 0, 0, 0)
print(ans)
'''
8 100 90 80
100
100
90
90
90
80
80
80

0


8 1000 800 100
300
333
400
444
500
555
600
666

243

'''