#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, A, B, C;
vector<int> v(n);
int dfs(vector<int> a, vector<int> b, vector<int> c, int i) {
  if (i == n) {
    if (a.size() == b.size() && b.size() == c.size() && (int)c.size() == 0) {
      return pow(10, 9);
    }
    int anss = 0, asum = 0, bsum = 0, csum = 0;
    for (int i = 0; i < (int)a.size(); i++) {
      asum += a.at(i);
    }
    for (int i = 0; i < (int)b.size(); i++) {
      bsum += b.at(i);
    }
    for (int i = 0; i < (int)c.size(); i++) {
      csum += c.at(i);
    }
    anss += 10 * max((int)(a.size() - 2), 0);
    anss += 10 * max((int)(b.size() - 2), 0);
    anss += 10 * max((int)(c.size() - 2), 0);
    anss += abs(asum - A);
    anss += abs(bsum - B);
    anss += abs(csum - C);
    return anss;
  }
  vector<int> as, bs, cs;
  as = a;
  bs = b;
  cs = c;
  as.push_back(v.at(i));
  bs.push_back(v.at(i));
  cs.push_back(v.at(i));
  return min({dfs(as, b, c, i + 1), dfs(a, bs, c, i + 1), dfs(a, b, cs, i + 1),
              dfs(a, b, c, i + 1)});
}
int main() {
  cin >> n >> A >> B >> C;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  cout << dfs({0}, {0}, {0}, 0) << endl;
}
