def calc_mp(ls, target):
    ret = 0
    ret += 10 * (len(ls) - 1)
    val = sum(ls)
    ret += abs(val - target)
    return ret


n, a, b, c = map(int, input().split())
l_ls = []
for i in range(n):
    l_ls.append(int(input()))

pattern = []

for i in range(4 ** n):
    tmp = [0] * n
    val = i
    for j in range(n):
        tmp[j] = val % 4
        val = val // 4
    pattern.append(tmp)

ret = 10 ** 100

for item in pattern:
    if 1 not in item or 2 not in item or 3 not in item:
        continue
    else:
        ones = []
        twos = []
        threes = []
        for i in range(n):
            if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
        mp = 0
        mp += calc_mp(ones, a)
        mp += calc_mp(twos, b)
        mp += calc_mp(threes, c)
        ret = min(ret, mp)

print(ret) def calc_mp(ls, target):
    ret = 0
    ret += 10 * (len(ls) - 1)
    val = sum(ls)
    ret += abs(val - target)
    return ret calc_mp ret = 0 ret 0 ret += 10 * (len(ls) - 1) ret 10 * (len(ls) - 1) 10 len(ls) - 1 len(ls) len ls 1 val = sum(ls) val sum(ls) sum ls ret += abs(val - target) ret abs(val - target) abs val - target val target return ret ret ls ls target target n, a, b, c = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split a b c l_ls = [] l_ls [] for i in range(n):
    l_ls.append(int(input())) i range(n) range n l_ls.append(int(input())) l_ls.append l_ls append int(input()) int input() input pattern = [] pattern [] for i in range(4 ** n):
    tmp = [0] * n
    val = i
    for j in range(n):
        tmp[j] = val % 4
        val = val // 4
    pattern.append(tmp) i range(4 ** n) range 4 ** n 4 n tmp = [0] * n tmp [0] * n [0] 0 n val = i val i for j in range(n):
        tmp[j] = val % 4
        val = val // 4
     j range(n) range n tmp[j] = val % 4 tmp[j] tmp j val % 4 val 4 val = val // 4 val val // 4 val 4 pattern.append(tmp) pattern.append pattern append tmp ret = 10 ** 100 ret 10 ** 100 10 100 for item in pattern:
    if 1 not in item or 2 not in item or 3 not in item:
        continue
    else:
        ones = []
        twos = []
        threes = []
        for i in range(n):
            if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
        mp = 0
        mp += calc_mp(ones, a)
        mp += calc_mp(twos, b)
        mp += calc_mp(threes, c)
        ret = min(ret, mp) item pattern if 1 not in item or 2 not in item or 3 not in item:
        continue
    else:
        ones = []
        twos = []
        threes = []
        for i in range(n):
            if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
        mp = 0
        mp += calc_mp(ones, a)
        mp += calc_mp(twos, b)
        mp += calc_mp(threes, c)
        ret = min(ret, mp) 1 not in item or 2 not in item or 3 not in item 1 not in item or 2 not in item 1 not in item 1 item 2 not in item 2 item 3 not in item 3 item continue ones = [] ones [] twos = [] twos [] threes = [] threes [] for i in range(n):
            if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
         i range(n) range n if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
         item[i] == 1 item[i] item i 1 ones.append(l_ls[i]) ones.append ones append l_ls[i] l_ls i elif item[i] == 2:
                twos.append(l_ls[i])
             item[i] == 2 item[i] item i 2 twos.append(l_ls[i]) twos.append twos append l_ls[i] l_ls i elif item[i] == 3:
                threes.append(l_ls[i])
         item[i] == 3 item[i] item i 3 threes.append(l_ls[i]) threes.append threes append l_ls[i] l_ls i mp = 0 mp 0 mp += calc_mp(ones, a) mp calc_mp(ones, a) calc_mp ones a mp += calc_mp(twos, b) mp calc_mp(twos, b) calc_mp twos b mp += calc_mp(threes, c) mp calc_mp(threes, c) calc_mp threes c ret = min(ret, mp) ret min(ret, mp) min ret mp print(ret) print ret val = i i val def calc_mp(ls, target):
    ret = 0
    ret += 10 * (len(ls) - 1)
    val = sum(ls)
    ret += abs(val - target)
    return ret def calc_mp(ls, target):
    ret = 0
    ret += 10 * (len(ls) - 1)
    val = sum(ls)
    ret += abs(val - target)
    return ret calc_mp mp += calc_mp(ones, a) calc_mp(ones, a) mp mp += calc_mp(twos, b) calc_mp(twos, b) mp l_ls = [] [] l_ls val = val // 4 val // 4 val mp += calc_mp(threes, c) calc_mp(threes, c) mp b, c = map(int, input().split()) map(int, input().split()) b twos = [] [] twos ret = 10 ** 100 10 ** 100 ret n, a, b, c = map(int, input().split()) map(int, input().split()) n ret = min(ret, mp) min(ret, mp) ret a, b, c = map(int, input().split()) map(int, input().split()) a ones = [] [] ones c = map(int, input().split()) map(int, input().split()) c mp = 0 0 mp threes = [] [] threes pattern = [] [] pattern tmp = [0] * n [0] * n tmp
def calc_mp(ls, target):
    ret = 0
    ret += 10 * (len(ls) - 1)
    val = sum(ls)
    ret += abs(val - target)
    return ret


n, a, b, c = map(int, input().split())
l_ls = []
for i in range(n):
    l_ls.append(int(input()))

pattern = []

for i in range(4 ** n):
    tmp = [0] * n
    val = i
    for j in range(n):
        tmp[j] = val % 4
        val = val // 4
    pattern.append(tmp)

ret = 10 ** 100

for item in pattern:
    if 1 not in item or 2 not in item or 3 not in item:
        continue
    else:
        ones = []
        twos = []
        threes = []
        for i in range(n):
            if item[i] == 1:
                ones.append(l_ls[i])
            elif item[i] == 2:
                twos.append(l_ls[i])
            elif item[i] == 3:
                threes.append(l_ls[i])
        mp = 0
        mp += calc_mp(ones, a)
        mp += calc_mp(twos, b)
        mp += calc_mp(threes, c)
        ret = min(ret, mp)

print(ret)
