#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b, c, ans = 10000000, num = 0, suma = 0, sumb = 0, sumc = 0;
  cin >> n >> a >> b >> c;
  int l[n];
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  for (int biti = 0; biti < (1 << n); ++biti) {
    vector<int> s;
    for (int i = 0; i < n; i++) {
      if (biti & (1 << i)) {
        s.push_back(1);
      } else {
        s.push_back(0);
      }
    }
    for (int bitj = 0; bitj < (1 << n); ++bitj) {
      vector<int> v;
      for (int j = 0; j < n; j++) {
        if (bitj & (1 << j)) {
          v.push_back(1);
        } else {
          v.push_back(0);
        }
      }
      for (int i = 0; i < n; i++) {
        if (s[i] == 0) {
          if (v[i] == 0) {
            if (suma != 0) {
              num += 10;
            }
            suma += l[i];
          } else {
            if (sumb != 0) {
              num += 10;
            }
            sumb += l[i];
          }
        } else {
          if (v[i] == 0) {
            if (sumc != 0) {
              num += 10;
            }
            sumc += l[i];
          }
        }
      }
      num += (abs(a - suma) + abs(b - sumb) + abs(c - sumc));
      ans = min(ans, num);
      num = 0, suma = 0, sumb = 0, sumc = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
