#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 1e9;
const long long int MAXN = 1e9;
int func(vector<int> p, int q) {
  int n = p.size();
  for (int i = 0; i < n; i++) {
    if (p[i] == q) return 0;
  }
  if (n == 1) {
    return abs(q - p[0]);
  }
  vector<int> s(n, 0);
  int mi = 10000;
  int pos = -1;
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (mi > abs(q - p[i]) && s[i] == 0) {
      mi = q - p[i];
      pos = i;
    }
  }
  s[pos]++;
  res = abs(q - p[pos]);
  int now = p[pos];
  bool flag = true;
  int ans = 0;
  while (flag) {
    flag = false;
    mi = res;
    pos = -1;
    for (int i = 0; i < n; i++) {
      if (res > abs(q - (now + p[i])) && s[i] == 0) {
        flag = true;
        pos = i;
        mi = abs(q - (now + p[i]));
      }
      if (flag) {
        ans += 10;
        s[pos]++;
        res = mi;
        now += p[pos];
      }
    }
  }
  return (ans + res);
}
int main() {
  int n, A, B, C;
  cin >> n >> A >> B >> C;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int ans = 1e9;
  do {
    for (int i = 0; i < n - 2; i++) {
      for (int j = i + 1; j < n - 1; j++) {
        vector<int> a, b, c;
        for (int k = 0; k <= i; k++) {
          a.push_back(x[k]);
        }
        for (int k = i + 1; k <= j; k++) {
          b.push_back(x[k]);
        }
        for (int k = j + 1; k < n; k++) {
          c.push_back(x[k]);
        }
        int res = func(a, A) + func(b, B) + func(c, C);
        ans = min(ans, res);
      }
    }
  } while (next_permutation(x.begin(), x.end()));
  cout << ans << endl;
  return 0;
}
