#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int calc(vector<int> v, int a, int b, int c, vector<int> l) {
  int x = 0, y = 0, z = 0;
  int cnt = 0;
  for (ll i = 0; i < v.size(); i++) {
    if (v[i] == 0) {
      if (x != 0) {
        cnt++;
      }
      x += l[i];
    }
    if (v[i] == 1) {
      if (y != 0) {
        cnt++;
      }
      y += l[i];
    }
    if (v[i] == 2) {
      if (z != 0) {
        cnt++;
      }
      z += l[i];
    }
  }
  return abs(a - x) + abs(b - y) + abs(c - z) + cnt * 10;
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  int ans = INT_MAX;
  for (ll i = 0; i < n; i++) {
    cin >> l[i];
  }
  for (int i = 0; i < (1 << 2 * n); i++) {
    vector<int> v(n);
    for (ll j = 0; j < n; j++) {
      v[j] = (i >> j * 2) & 3;
    }
    ans = min(ans, calc(v, a, b, c, l));
  }
  cout << ans;
}
