"use strict";
const Main = input => {
    const value = input[0].split(' ');
    const n = Number(value[0]), 
    A = Number(value[1]), 
    B = Number(value[2]), 
    C = Number(value[3]);
    let l = new Array(n);
    for(let i=0;i<n; i++) {
        l[i] = Number(input[i+1]);
    }    
    const INF = 1000000000;
    const dfs = (cur, a, b, c) => {
        if (cur == n) {
            if (Math.min(a,b,c) > 0) {
                return Math.abs(a-A) + Math.abs(b-B) + Math.abs(c-C)- 30;
            } else {
                return INF;
            }
        }
        return Math.min(dfs(cur+1,a,b,c), 
        dfs(cur+1,a+l[cur],b,c)+10, 
        dfs(cur+1,a,b+l[cur],c)+10, 
        dfs(cur+1,a,b,c+l[cur])+10);
    };
    console.log(dfs(0,0,0,0));
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));