#include <bits/stdc++.h>
using namespace std;
int l[123], len[123], per[123];
int a, b, c, n;
int now;
void dfs(int f, int to, int obj, int p, int mon, int flag) {
  if (!flag)
    p = l[f];
  else
    p += l[f];
  if (obj == p) {
    now = min(now, mon);
    return;
  }
  now = min(now, mon + abs(obj - p));
  for (register int i = f + 1; i <= to; i++) {
    dfs(i, to, obj, p, mon + 10, 1);
    dfs(i, to, obj, p, mon, 0);
  }
}
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &c);
  int T = 1;
  for (register int i = 1; i <= n; i++) {
    T *= i;
    scanf("%d", &len[i]);
    per[i] = i;
  }
  T *= 0.7;
  register int ans = 1e9 + 11;
  register int cnt = 0;
  while (T--) {
    for (register int i = 1; i <= n; i++) l[i] = len[per[i]];
    for (register int i = 1; i <= n - 2; i++) {
      for (register int j = i + 1; j <= n - 1; j++)
        for (register int k = j + 1; k <= n; k++) {
          now = 1e9 + 11;
          dfs(1, i, a, 0, 0, 0);
          int ap = now;
          now = 1e9 + 11;
          dfs(j, k - 1, b, 0, 0, 0);
          int bp = now;
          now = 1e9 + 11;
          dfs(k, n, c, 0, 0, 0);
          int cp = now;
          if (ap + bp + cp < ans) {
            ans = ap + bp + cp;
            cnt = 0;
          }
          cnt++;
        }
    }
    random_shuffle(per + 1, per + n + 1);
  }
  printf("%d\n", ans);
  return 0;
}
