#[derive(Clone, Copy, PartialEq)]
enum Bamboo {
    A, B, C, None,
}

fn abs_sub(x: usize, y: usize) -> usize {
    std::cmp::max(x, y) - std::cmp::min(x, y)
}

fn calc(a: usize, b: usize, c: usize, ls: &Vec<usize>, bamboos: &Vec<Bamboo>) -> usize {
    let mut alen: usize = 0;
    let mut blen: usize = 0;
    let mut clen: usize = 0;
    let mut concat_mp: usize = 0;

    for (i, b) in bamboos.iter().enumerate() {
        match b {
            Bamboo::A => {concat_mp += if alen == 0 {0} else {10}; alen += ls[i]},
            Bamboo::B => {concat_mp += if blen == 0 {0} else {10}; blen += ls[i]},
            Bamboo::C => {concat_mp += if clen == 0 {0} else {10}; clen += ls[i]},
            _ => {},
        }
    }
    abs_sub(a, alen) + abs_sub(b, blen) + abs_sub(c, clen) + concat_mp
}

fn dfs(n: usize, a: usize, b: usize, c: usize, ls: &Vec<usize>, depth: usize, mut bamboos: &mut Vec<Bamboo>) -> Option<usize> {
    if depth < n {
        let mut min: Option<usize> = None;
        for i in [Bamboo::A, Bamboo::B, Bamboo::C, Bamboo::None].iter() {
            bamboos[depth] = *i;
            if let Some(v) = dfs(n, a, b, c, &ls, depth+1, &mut bamboos) {
                if min.is_none() {
                    min = Some(v);
                }
                else {
                    min = Some(std::cmp::min(min.unwrap(), v));
                }
            }
        }
        min
    }
    else {
        if bamboos.contains(&Bamboo::A) &&
           bamboos.contains(&Bamboo::B) &&
           bamboos.contains(&Bamboo::C) {
            Some(calc(a, b, c, &ls, &bamboos))
        }
        else {
            None
        }
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let c: usize = iter.next().unwrap().parse().unwrap();

    let mut ls = Vec::with_capacity(8);

    for _ in 0..n {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let l: usize = buf.trim().parse().unwrap();
        ls.push(l);
    }

    let mut bamboos = vec![Bamboo::None; n];
    println!("{}", dfs(n, a, b, c, &ls, 0, &mut bamboos).unwrap());
}
