import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT)

def cost(id, div, x):
    n = len(div)
    use = []
    for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

    return (len(use) - 1) * 10 + abs(x - sum(use))


def eachtake(div, x):
    n = len(div)
    ret = INF

    for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

    return ret


def eachpat(pat, a, b, c, li, n):
    div = [[] for i in range(3)]
    for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

    for i in range(3):
        if not div[i]:
            return INF

    ret = 0
    ret += eachtake(div[0], a)
    ret += eachtake(div[1], b)
    ret += eachtake(div[2], c)
    
    return ret


def solve():
    n, a, b, c = getList()
    li = []
    for i in range(n):
        li.append(getN())

    ans = INF
    for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
    # print(eachtake([333], 100)) import sys sys import math math import copy copy from heapq import heappush, heappop, heapify from functools import cmp_to_key from bisect import bisect_left, bisect_right from collections import defaultdict, deque, Counter input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline getS = lambda: input().strip() getS lambda: input().strip() input().strip() ().strip () input strip getN = lambda: int(input()) getN lambda: int(input()) int(input()) int input() input getList = lambda: list(map(int, input().split())) getList lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split int(x) - 1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) - 1 int(x) int x 1 getZList = lambda: [int(x) - 1 for x in input().split()] getZList lambda: [int(x) - 1 for x in input().split()] [int(x) - 1 for x in input().split()] INF = float("inf") INF float("inf") float "inf" MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 divide = lambda x: pow(x, MOD-2, MOD) divide lambda x: pow(x, MOD-2, MOD) pow(x, MOD-2, MOD) pow x MOD-2 MOD 2 MOD x class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT) BIT def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
     __init__ self.n = n self.n self n n self.BIT = [0] * (n + 2) self.BIT self BIT [0] * (n + 2) [0] 0 n + 2 n 2 self self n n def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
     query res_sum = 0 res_sum 0 while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
         idx > 0 idx 0 res_sum += self.BIT[idx] res_sum self.BIT[idx] self.BIT self BIT idx idx -= idx & (-idx) idx idx & (-idx) idx -idx idx return res_sum res_sum self self idx idx def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

     update while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
         idx <= self.n idx self.n self n self.BIT[idx] += x self.BIT[idx] self.BIT self BIT idx x idx += idx & (-idx) idx idx & (-idx) idx -idx idx return self self idx idx x x def show(self):
        print(self.BIT) show print(self.BIT) print self.BIT self BIT self self def cost(id, div, x):
    n = len(div)
    use = []
    for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

    return (len(use) - 1) * 10 + abs(x - sum(use)) cost n = len(div) n len(div) len div use = [] use [] for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

     i range(n) range n if id % 2 == 1:
            use.append(div[i])
         id % 2 == 1 id % 2 id 2 1 use.append(div[i]) use.append use append div[i] div i id //= 2 id 2 return (len(use) - 1) * 10 + abs(x - sum(use)) (len(use) - 1) * 10 + abs(x - sum(use)) (len(use) - 1) * 10 len(use) - 1 len(use) len use 1 10 abs(x - sum(use)) abs x - sum(use) x sum(use) sum use id id div div x x def eachtake(div, x):
    n = len(div)
    ret = INF

    for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

    return ret eachtake n = len(div) n len(div) len div ret = INF ret INF for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

     id range(1, 1 << n) range 1 1 << n 1 n tmp = cost(id, div, x) tmp cost(id, div, x) cost id div x ret = min(tmp, ret) ret min(tmp, ret) min tmp ret return ret ret div div x x def eachpat(pat, a, b, c, li, n):
    div = [[] for i in range(3)]
    for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

    for i in range(3):
        if not div[i]:
            return INF

    ret = 0
    ret += eachtake(div[0], a)
    ret += eachtake(div[1], b)
    ret += eachtake(div[2], c)
    
    return ret eachpat [] for i in range(3) for i in range(3) i range(3) range 3 for i in range(3) [] div = [[] for i in range(3)] div [[] for i in range(3)] for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

     i range(n) range n if pat % 4 != 3:
            div[pat%4].append(li[i])
         pat % 4 != 3 pat % 4 pat 4 3 div[pat%4].append(li[i]) [pat%4].append [pat%4] div pat%4 pat 4 append li[i] li i pat //= 4 pat 4 for i in range(3):
        if not div[i]:
            return INF

     i range(3) range 3 if not div[i]:
            return INF

     not div[i] div[i] div i return INF INF ret = 0 ret 0 ret += eachtake(div[0], a) ret eachtake(div[0], a) eachtake div[0] div 0 a ret += eachtake(div[1], b) ret eachtake(div[1], b) eachtake div[1] div 1 b ret += eachtake(div[2], c) ret eachtake(div[2], c) eachtake div[2] div 2 c return ret ret pat pat a a b b c c li li n n def solve():
    n, a, b, c = getList()
    li = []
    for i in range(n):
        li.append(getN())

    ans = INF
    for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

    print(ans) solve n, a, b, c = getList() n getList() getList a b c li = [] li [] for i in range(n):
        li.append(getN())

     i range(n) range n li.append(getN()) li.append li append getN() getN ans = INF ans INF for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

     pat range(4 ** n) range 4 ** n 4 n tmp = eachpat(pat, a, b, c, li, n) tmp eachpat(pat, a, b, c, li, n) eachpat pat a b c li n ans = min(ans, tmp) ans min(ans, tmp) min ans tmp print(ans) print ans def main():
    n = getN()
    for _ in range(n):
        solve()

    return main n = getN() n getN() getN for _ in range(n):
        solve()

     _ range(n) range n solve() solve return if __name__ == "__main__":
    # main()
    solve()
    # print(eachtake([333], 100)) __name__ == "__main__" __name__ "__main__" solve() solve def eachpat(pat, a, b, c, li, n):
    div = [[] for i in range(3)]
    for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

    for i in range(3):
        if not div[i]:
            return INF

    ret = 0
    ret += eachtake(div[0], a)
    ret += eachtake(div[1], b)
    ret += eachtake(div[2], c)
    
    return ret def eachpat(pat, a, b, c, li, n):
    div = [[] for i in range(3)]
    for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

    for i in range(3):
        if not div[i]:
            return INF

    ret = 0
    ret += eachtake(div[0], a)
    ret += eachtake(div[1], b)
    ret += eachtake(div[2], c)
    
    return ret eachpat def eachtake(div, x):
    n = len(div)
    ret = INF

    for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

    return ret def eachtake(div, x):
    n = len(div)
    ret = INF

    for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

    return ret eachtake MOD = 10**9 + 7 10**9 + 7 MOD getS = lambda: input().strip() lambda: input().strip() getS def solve():
    n, a, b, c = getList()
    li = []
    for i in range(n):
        li.append(getN())

    ans = INF
    for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

    print(ans) def solve():
    n, a, b, c = getList()
    li = []
    for i in range(n):
        li.append(getN())

    ans = INF
    for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

    print(ans) solve INF = float("inf") float("inf") INF getN = lambda: int(input()) lambda: int(input()) getN getList = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) getList getZList = lambda: [int(x) - 1 for x in input().split()] lambda: [int(x) - 1 for x in input().split()] getZList def cost(id, div, x):
    n = len(div)
    use = []
    for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

    return (len(use) - 1) * 10 + abs(x - sum(use)) def cost(id, div, x):
    n = len(div)
    use = []
    for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

    return (len(use) - 1) * 10 + abs(x - sum(use)) cost class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT) class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT) BIT def main():
    n = getN()
    for _ in range(n):
        solve()

    return def main():
    n = getN()
    for _ in range(n):
        solve()

    return main input = sys.stdin.readline sys.stdin.readline input divide = lambda x: pow(x, MOD-2, MOD) lambda x: pow(x, MOD-2, MOD) divide
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT)

def cost(id, div, x):
    n = len(div)
    use = []
    for i in range(n):
        if id % 2 == 1:
            use.append(div[i])
        id //= 2

    return (len(use) - 1) * 10 + abs(x - sum(use))


def eachtake(div, x):
    n = len(div)
    ret = INF

    for id in range(1, 1 << n):
        tmp = cost(id, div, x)
        ret = min(tmp, ret)

    return ret


def eachpat(pat, a, b, c, li, n):
    div = [[] for i in range(3)]
    for i in range(n):
        if pat % 4 != 3:
            div[pat%4].append(li[i])
        pat //= 4

    for i in range(3):
        if not div[i]:
            return INF

    ret = 0
    ret += eachtake(div[0], a)
    ret += eachtake(div[1], b)
    ret += eachtake(div[2], c)
    
    return ret


def solve():
    n, a, b, c = getList()
    li = []
    for i in range(n):
        li.append(getN())

    ans = INF
    for pat in range(4 ** n):
        tmp = eachpat(pat, a, b, c, li, n)
        ans = min(ans, tmp)

    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
    # print(eachtake([333], 100))