#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, ans;
string s;
int l[10];
string three(int x, int m) {
  string t = "";
  for (int i = 0; i < m; i++) {
    if (x == 0)
      t = '0' + t;
    else {
      if (x % 3 == 0) t = '0' + t;
      if (x % 3 == 1) t = '1' + t;
      if (x % 3 == 2) t = '2' + t;
    }
    x /= 3;
  }
  return t;
}
int main(void) {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  for (int i = 0; i < pow(3, n); i++) {
    int u = 0, v = 0, w = 0, p = 0, q = 0, r = 0;
    s = three(i, n);
    for (int j = 0; j < n; j++) {
      int f = 0, g = 0, h = 0;
      if (l[j] == a) {
        u = l[j];
        f = 1;
      }
      if (l[j] == b) {
        v = l[j];
        g = 1;
      }
      if (l[j] == c) {
        w = l[j];
        h = 1;
      }
      if (s[j] == '0' && f == 0) {
        u += l[j];
        p++;
      }
      if (s[j] == '1' && g == 0) {
        v += l[j];
        q++;
      }
      if (s[j] == '2' && h == 0) {
        w += l[j];
        r++;
      }
    }
    if (p > 1) p--;
    if (q > 1) q--;
    if (r > 1) r--;
    int cost = abs(a - u) + abs(b - v) + abs(c - w) + (p + q + r) * 10;
    if (i == 0 || ans > cost) ans = cost;
  }
  cout << ans << endl;
}
