#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int ans = 1000;
  for (uint i = 0; i < 1U << (2 * n); i++) {
    int mp = 0;
    vector<uint> x(4);
    for (uint m = 0; m < n; m++) {
      uint ix = (i & (3U << (2 * m))) >> (2 * m);
      if (ix != 0) {
        x[ix] += l[m];
        mp += 10;
      }
    }
    if (x[1] == 0 || x[2] == 0 || x[3] == 0) continue;
    mp += x[1] > a ? x[1] - a : a - x[1];
    mp += x[2] > b ? x[2] - b : b - x[2];
    mp += x[3] > c ? x[3] - c : c - x[3];
    mp -= 30;
    ans = min(ans, mp);
  }
  cout << ans << endl;
}
