#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long mod2 = 998244353;
const int INF = 2000000000;
int distance(int a, int b) {
  if (a < b) swap(a, b);
  return a - b;
}
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];
  vector<int> stick(n + 1, 0);
  int ans = INF;
  for (int i = 0; i < (pow(4, n)); ++i) {
    int asum = 0;
    int bsum = 0;
    int csum = 0;
    int mp = -30;
    for (int j = 0; j < (n); ++j) {
      if (stick[j] == 3) continue;
      if (stick[j] == 0) asum += l[j];
      if (stick[j] == 1) bsum += l[j];
      if (stick[j] == 2) csum += l[j];
      mp += 10;
    }
    stick[0]++;
    for (int j = 0; j < (n); ++j) {
      if (stick[j] == 4) {
        stick[j + 1]++;
        stick[j] = 0;
      }
    }
    if (asum == 0 || bsum == 0 || csum == 0) continue;
    mp += distance(a, asum);
    mp += distance(b, bsum);
    mp += distance(c, csum);
    ans = min(ans, mp);
  }
}
