fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let q: Vec<i32> = read()
        .trim()
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect();
    let n = q[0] as usize;
    let abc = vec![q[1], q[2], q[3]];
    let ls: Vec<i32> = (0..n).map(|_| read().trim().parse().unwrap()).collect();

    let mut ans: i32 = 10000000;
    for permute in 0..(4_usize.pow(n as u32)) {
        let mut mp = 0;

        let mut abc_extend = vec![0; 3];
        let mut r = permute;
        for l in ls.iter() {
            mp += 10;
            match r % 4 {
                i if i < 3 => abc_extend[i] += l,
                _ => mp -= 10,
            }
            r /= 4;
        }
        if abc_extend.iter().any(|&x| x == 0) {
            continue;
        }

        mp += (0..3).map(|k| (abc[k] - abc_extend[k]).abs()).sum::<i32>() - 30;
        ans = std::cmp::min(ans, mp);
    }
    println!("{}", ans);
}
