#include<bits/stdc++.h>
using namespace std;int N,A,B,C,l[9],i;int dfs(int a,int b,int c,int mp,int i){return i==N?a&&b&&c?10*mp+abs(A-a)+abs(B-b)+abs(C-c):10000:min({dfs(a,b,c,mp,i+1),dfs(a+l[i],b,c,mp+1,i+1),dfs(a,b+l[i],c,mp+1,i+1),dfs(a,b,c+l[i],mp+1,i+1)});}
int main(){cin>>N>>A>>B>>C;while(i<N)cin>>l[i++];cout<<dfs(0,0,0,0,0)-30<<endl;}