#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, i, l[9], ans;
void dfs(int x, int A, int B, int C, int s) {
  if (x > n && A && B && C) {
    ans = min(ans, s + abs(a - A) + abs(b - B) + abs(c - C));
    return;
  }
  dfs(x + 1, A, B, C, s);
  dfs(x + 1, A + l[x], B, C, s + 10 * (A > 0));
  dfs(x + 1, A, B + l[x], C, s + 10 * (B > 0));
  dfs(x + 1, A, B, C + l[x], s + 10 * (C > 0));
}
int main() {
  ans = 1e9;
  cin >> n >> a >> b >> c;
  for (i = 1; i <= n; i++) cin >> l[i];
  dfs(1, 0, 0, 0, 0);
  printf("%d", ans);
  return 0;
}
