from itertools import product
from sys import stdin
input = stdin.buffer.readline

def main():
    n, *abc = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

    print(ans)

main() from itertools import product from sys import stdin input = stdin.buffer.readline input stdin.buffer.readline stdin.buffer stdin buffer readline def main():
    n, *abc = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

    print(ans) main n, *abc = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split *abc abc int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input l = [int(input()) for _ in range(n)] l [int(input()) for _ in range(n)] ans = 10**9 ans 10**9 10 9 for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

     prod product([0, 1, 2, 3], repeat=n) product [0, 1, 2, 3] 0 1 2 3 repeat=n repeat n cost = 10 * (n-3) cost 10 * (n-3) 10 n-3 n 3 lengths = [0, 0, 0] lengths [0, 0, 0] 0 0 0 for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

         i x enumerate(prod) enumerate prod if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

         x < 3 x 3 lengths[x] += l[i] lengths[x] lengths x l[i] l i cost -= 10 cost 10 for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

     i lengths if i == 0:
                break

         i == 0 i 0 break for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
             i x enumerate(abc) enumerate abc cost += abs(x - lengths[i]) cost abs(x - lengths[i]) abs x - lengths[i] x lengths[i] lengths i if cost < ans:
                ans = cost

     cost < ans cost ans ans = cost ans cost print(ans) print ans main() main def main():
    n, *abc = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

    print(ans) def main():
    n, *abc = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

    print(ans) main input = stdin.buffer.readline stdin.buffer.readline input
from itertools import product
from sys import stdin
input = stdin.buffer.readline

def main():
    n, *abc = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for prod in product([0, 1, 2, 3], repeat=n):
        cost = 10 * (n-3)
        lengths = [0, 0, 0]
        for i, x in enumerate(prod):
            if x < 3:
                lengths[x] += l[i]
            else:
                cost -= 10

        for i in lengths:
            if i == 0:
                break

        else:
            for i, x in enumerate(abc):
                cost += abs(x - lengths[i])
            if cost < ans:
                ans = cost

    print(ans)

main()