#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int N;
int A,B,C;

  long long brute_force_search(int cnt, int a, int b, int c, int len[]) {
    long long INF = std::pow(10, 9.0);
    if (cnt==N) {
      //return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      
      if ((a>0)&&(b>0)&&(c>0)){
        return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      } else {
        return INF;
      }
    }
    vector<long long> ansc(4);
    ansc[0] = brute_force_search(cnt+1, a, b, c, len);
    ansc[1] = brute_force_search(cnt+1, a+L[cnt], b, c, len)+10;
    ansc[2] = brute_force_search(cnt+1, a, b+L[cnt], c, len)+10;
    ansc[3] = brute_force_search(cnt+1, a, b, c+L[cnt], len)+10;
    int min = *std::min_element(ansc.begin(), ansc.end());
    return min;
  }

int main() {
  cin >> N >> A >> B >> C;
  
  int L[N];
  for (int i; i<N;i++){
    cin >> L[i];
  } 
  
  long long ans;
  ans = brute_force_search(0, 0, 0, 0, L);
  cout << ans << endl;
  return 0;
}