use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();
    let l: Vec<i32> = (0..n)
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();

    let x = 4u32.pow(n as u32);
    let mut ans = std::i32::MAX;

    for bit in 0..x {
        let mut sumA = 0i32;
        let mut sumB = 0i32;
        let mut sumC = 0i32;
        let mut cost = 0i32 ;
        let mut t = bit;
        let mut cursor = 0;
        while t > 0 {
            let m = t % 4;
            if m == 0 {
                if sumA > 0 {
                    cost += 10;
                }
                sumA += l[cursor];
            } else if m == 1 {
                if sumB > 0 {
                    cost += 10;
                }
                sumB += l[cursor];
            } else if m == 2 {
                if sumC > 0 {
                    cost += 10;
                }
                sumC += l[cursor];
            }
            t /= 4;
            cursor += 1;
        }
        if sumA == 0 || sumB == 0 || sumC == 0 {
            continue;
        }
        ans = std::cmp::min(ans, cost + (a - sumA).abs() + (b - sumB).abs() + (c - sumC).abs());
    }

    println!("{}", ans);
}
