#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, l[8], f[8], d[4];
int dfs(int x) {
  int i, aa = 0, bb = 0, cc = 0, ans = 0, d[4];
  if (x == n) {
    for (i = 0; i < n; i++) {
      if (f[i] == 0) {
        aa += l[i];
        d[0]++;
      } else if (f[i] == 1) {
        bb += l[i];
        d[1]++;
      } else if (f[i] == 2) {
        cc += l[i];
        d[2]++;
      }
    }
    ans += abs(a - aa);
    ans += abs(bb - b);
    ans += abs(cc - c);
    for (i = 0; i < 3; i++) {
      if (d[i] == 0)
        return 10000;
      else
        ans += 10 * (d[i] - 1);
    }
    return ans;
  }
  ans = 10000;
  for (i = 0; i < 4; i++) {
    f[x] = i;
    ans = min(ans, dfs(x + 1));
  }
  return ans;
}
int main() {
  int i;
  scanf("%d %d %d %d", &n, &a, &b, &c);
  for (i = 0; i < n; i++) scanf("%d", &l[i]);
  printf("%d\n", dfs(0));
  return 0;
}
