#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, ans = INT_MAX, A, B, C;
int res[100];
int main() {
  n = read();
  A = read();
  B = read();
  C = read();
  for (int i = 0; i < n; i++) {
    res[i] = read();
  }
  int cost1 = 0, cost2 = 0, cost3 = 0;
  for (int i = 0; i <= pow(2, n - 1); i++) {
    for (int j = 0; j <= pow(2, n - 1); j++) {
      if ((i & j) == 0) {
        for (int k = 0; k <= pow(2, n - 1); k++) {
          if ((j & k) == 0 && (i & k) == 0) {
            int cnt1 = 0, cnt2 = 0, cnt3 = 0;
            cost1 = cost2 = cost3 = 0;
            for (int p = 0; p < n; p++) {
              if ((1 << p) & i) {
                cost1 += res[p];
                cnt1++;
              }
              if ((1 << p) & j) {
                cost2 += res[p];
                cnt2++;
              }
              if ((1 << p) & k) {
                cost3 += res[p];
                cnt3++;
              }
            }
            int now = abs(cost1 - A) + abs(cost2 - B) + abs(cost3 - C);
            now += (cnt1 - 1) * 10 + (cnt2 - 1) * 10 + (cnt3 - 1) * 10;
            ans = min(ans, now);
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
