#include <iostream>
#include <math.h>
using namespace std;
int n,a,b,c,v[10];
int solve(int k,int x,int y,int z) {
    if(k==n+1) {
        int ans=abs(a-x)+abs(b-y)+abs(c-z);
        if(x==0||y==0||z==0)
            return 10000;
        return ans;
    }
    int ans=min(solve(k+1,x+v[k],y,z)+10,solve(k+1,x,y+v[k],z)+10);
    ans=min(ans,solve(k+1,x,y,z+v[k])+10);
    ans=min(ans,solve(k+1,x,y,z));
    return ans;
}
int main() {
    int i;
    cin >> n >> a >> b >> c;
    for(i=1;i<=n;i++)
        cin >> v[i];
    cout << solve(1,0,0,0)-30;
    return 0;
}