#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, a, b, c, ans = 1000000000;
  cin >> n >> a >> b >> c;
  vector<long long> l(n);
  for (long long i = 0; i < n; i++) {
    cin >> l[i];
  }
  for (long long i = 0; i < pow(4, n); i++) {
    long long bit[n];
    for (long long j = 0; j < n; j++) bit[j] = i / (long long)pow(4, j) % 4;
    long long x = 0, y = 0, z = 0, xc = -1, yc = -1, zc = -1;
    for (long long j = 0; j < n; j++) {
      if (bit[j] == 1) {
        xc++;
        x += l[j];
      } else if (bit[j] == 2) {
        yc++;
        y += l[j];
      } else if (bit[j] == 3) {
        zc++;
        z += l[j];
      }
    }
    ans = min(ans, abs(x - a) + abs(y - b) + abs(z - c) + (xc + yc + zc) * 10);
  }
  cout << ans << endl;
}
