#include <bits/stdc++.h>
using namespace std;
int min(int x, int y, int z) {
  int res = min(x, y);
  return min(res, z);
}
int min(int x, int y, int z, int w) {
  int res = min(x, y);
  res = min(res, z);
  return min(res, w);
}
int ans = 1e9;
int a, b, c, n;
int l[15];
int dfs(int x, int y, int z, int cur) {
  if (cur == n + 1) {
    if (min(a, b, c) <= 0) return 1e9;
    return abs(a - x) + abs(b - y) + abs(z - c) - 30;
  }
  int a1 = dfs(x, y, z, cur + 1);
  int a2 = dfs(x + l[cur], y, z, cur + 1) + 10;
  int a3 = dfs(x, y + l[cur], z, cur + 1) + 10;
  int a4 = dfs(x, y, z + l[cur], cur + 1) + 10;
  return min(a1, a2, a3, a4);
}
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &c);
  for (int i = 1; i <= n; i++) scanf("%d", &l[i]);
  printf("%d\n", dfs(0, 0, 0, 1));
  return 0;
}
