#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
// input macro
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [i32; 3],
        l: [i32; n],
    }
    let sum = (0..1 << n)
        .map(|bit| {
            (0..n)
                .map(|i| if bit >> i & 1 != 0 { l[i] } else { 0 })
                .sum::<i32>()
        })
        .collect::<Vec<_>>();
    let mut ans: i32 = 1e9 as i32;
    for bit1 in 1..(1 << n) {
        for bit2 in 1..(1 << n) {
            if bit1 & bit2 != 0 {
                continue;
            }
            for bit3 in 1..(1 << n) {
                if bit1 & bit3 != 0 || bit2 & bit3 != 0 {
                    continue;
                }
                let mut s = 0;
                for i in 1..n {
                    if bit1 >> i & 1 != 0 || bit2 >> i & 1 != 0 || bit3 >> i & 1 != 0 {
                        s += 1;
                    }
                }
                s = (s - 2)* 10;
                let sub = (a[0] - sum[bit1]).abs() + (a[1] - sum[bit2]).abs() + (a[2] - sum[bit3]).abs();
                ans = min(ans, sub + (s as i32));
            }
        }
    }
    println!("{}", ans);
}
