# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)

def main():
    print(5 & 3)
    N,A,B,C = cin.mapInt()
    L = cin.intColsList(N)

    ans = int(1e09)
    for i in range(1 << N * 2):
        D = [0] * 3
        mp = 0
        for j in range(N):
            n = (i >> (j * 2)) & 3
            if n == 0:
                continue
            if D[n - 1] > 0:
                mp += 10
            D[n - 1] += L[j]
        if 0 in D:
            continue
        mp += abs(A - D[0])
        mp += abs(B - D[1])
        mp += abs(C - D[2])
        ans = min(ans,mp)
    print(ans)
    return

if __name__ == "__main__":
    main()
