#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> f(n);
  for (int i = 0; i < n; i++) {
    cin >> f[i];
  }
  long long int ans = 1e20;
  for (int i = 0; i < pow(4, n); i++) {
    long long int sub = 0;
    long long int aa = 0, bb = 0, cc = 0;
    long long int cnta = 0, cntb = 0, cntc = 0;
    for (int j = 0; j < n; j++) {
      int s = i / pow(4, j);
      if (s % 4 == 1) {
        aa += f[j];
        cnta++;
      }
      if (s % 4 == 2) {
        bb += f[j];
        cntb++;
      }
      if (s % 4 == 3) {
        cc += f[j];
        cntc++;
      }
    }
    if (min(aa, min(bb, cc)) > 0) {
      sub = abs(aa - a) + abs(bb - b) + abs(cc - c);
    } else {
      sub = 1e20;
    }
    if (cnta != 0) sub += (cnta - 1) * 10;
    if (cntb != 0) sub += (cntb - 1) * 10;
    if (cntc != 0) sub += (cntc - 1) * 10;
    ans = min(ans, sub);
  }
  cout << ans << endl;
  return 0;
}
