#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
void chmin(int &a, int b)
{
    if (a > b)
    {
        a = b;
    }
}

vector<int> l;
int n, A, B, C;
int dfs(int i, int a, int b, int c)
{
    if (i == n)
    {
        if (a * b * c == 0)
        {
            return;
        }
        else
        {
            return abs(a - A) + abs(b - B) + abs(c - C);
        }
    }
    //今ある竹を採用しない場合
    int res = dfs(i + 1, a, b, c);
    //A,B,Cのいずれかを使う場合
    chmin(res,dfs(i+1,a+l[i],b,c)+(a?10:0));
    chmin(res,dfs(i+1,a,b+l[i],c)+(b?10:0));
    chmin(res,dfs(i+1,a,b,c+l[i])+(c?10:0));

    return res;
}

int main()
{
    int a, b, c, i;
    cin >> n >> a >> b >> c;
    l.resize(n);
    rep(i, n)
    {
        cin >> l[i];
    }
    cout<<dfs(0,0,0,0)<<endl;
}