#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long> aa, bb, cc, un;
  vector<long> take(n);
  for (long i = 0; i < n; i++) {
    cin >> take[i];
  }
  long res = 50000;
  for (long i = 0; i < (1 << (2 * n)); i++) {
    long tmp = i;
    long cnt = 0;
    while (tmp != 0) {
      if (tmp % 4 == 0) {
        aa.push_back(take[cnt]);
      } else if (tmp % 4 == 1) {
        bb.push_back(take[cnt]);
      } else if (tmp % 4 == 2) {
        cc.push_back(take[cnt]);
      }
      cnt++;
      tmp /= 4;
    }
    if (aa.size() == 0 or bb.size() == 0 or cc.size() == 0) continue;
    long tres = 0;
    if (aa.size() != 0) {
      tres += (aa.size() - 1) * 10;
      tres += abs(a - accumulate(aa.begin(), aa.end(), 0));
    } else {
      tres += a;
    }
    if (bb.size() != 0) {
      tres += (bb.size() - 1) * 10;
      tres += abs(b - accumulate(bb.begin(), bb.end(), 0));
    } else {
      tres += b;
    }
    if (cc.size() != 0) {
      tres += (cc.size() - 1) * 10;
      tres += abs(c - accumulate(cc.begin(), cc.end(), 0));
    } else {
      tres += c;
    }
    res = min(res, tres);
    aa.clear();
    bb.clear();
    cc.clear();
  }
  cout << res;
  return 0;
}
