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

int n, a, b, c, l[8];

long long dfs(int cur, int x, int y, int z){
  if(cur==n){
    if(min(x,min(y,z))==0) return INT_MAX;
    return abs(a-x)+abs(b-y)+abs(c-z)-3*10;
  }

  return min(dfs(cur+1,x,y,z), min(dfs(cur+1,x+l[cur],y,z)+10, min(dfs(cur+1,x,y+l[cur],z)+10, dfs(cur+1,x,y,z+l[cur])+10)));
}

int main(){
  scanf("%d %d %d %d", &n, &a, &b, &c);
  for(int i = 0; i < n; i++){
    scanf("%d", &l[i]);
  }

  printf("%lld\n", dfs(0,0,0,0));
  return 0;
}