#include<bits/stdc++.h>
using namespace std;

int n,a,b,c;
vector<int> arr(9);

int sol(int x,int y, int z,int idx){
 if(idx == n){
   return min(min(x,y),z) > 0 ? abs(x-a)+abs(y-b)+abs(z-c)-30 : 1e9;
   
 } 
  int r1 = sol(x,y,z,idx+1);
  int r2 = sol(x+arr[idx],y,z,idx+1)+10;
  int r3 = sol(x,y+arr[idx],z,idx+1)+10;
  int r4 = sol(x,y,z+arr[idx],idx+1)+10;
  int m1 = min(r1,r2);
  int m2 = min(r3,r4);
  return min(m1,m2);
}

int main(){
  cin>>n>>a>>b>>c;
	
  for(int i = 0; i < n; i++) cin>>arr[i];
 cout<<sol(0,0,0,0);  

}
