#include <bits/stdc++.h>
using namespace std;
vector<int> l(0);
int N;
int A, B, C;
int dfs(int a, int b, int c, int n, int score);
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int aaaa;
    cin >> aaaa;
    l.push_back(aaaa);
  }
  cout << dfs(0, 0, 0, 0, 0) << endl;
  return 0;
}
int dfs(int a, int b, int c, int n, int score) {
  if (n == N) {
    return abs(A - a) + abs(B - b) + abs(C - c) + 10 * score;
  }
  int m, p, k, j;
  m = dfs(a + l[n], b, c, n + 1, score + 1);
  p = dfs(a, b + l[n], c, n + 1, score + 1);
  k = dfs(a, b, c + l[n], n + 1, score + 1);
  j = dfs(a, b, c, n + 1, score);
  m = min(m, p);
  k = min(k, j);
  return min(m, k);
}
