#include <bits/stdc++.h>
using namespace std;
int s[8];
int l[8];
int n, a, b, c;
int ans = 1e9;
int check(void) {
  int sum = 0;
  int a1 = 0, b1 = 0, c1 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 1) {
      if (a1 != 0) sum += 10;
      a1 += l[i];
    } else if (s[i] == 2) {
      if (b1 != 0) sum += 10;
      b1 += l[i];
    } else if (s[i] == 3) {
      if (c1 != 0) sum += 10;
      c1 += l[i];
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] != 0)
      continue;
    else if (a1 == 0) {
      a1 = l[i];
    } else if (b1 == 0) {
      b1 = l[i];
    } else if (c1 == 0) {
      c1 = l[i];
    }
  }
  sum += abs(a - a1) + abs(b - b1) + abs(c - c1);
  return sum;
}
int rec(int j) {
  for (int i = 0; i < 4; i++) {
    s[j] = i;
    if (j == n - 1)
      ans = min(ans, check());
    else
      rec(j + 1);
  }
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  sort(l, l + n);
  rec(0);
  cout << ans << endl;
}
