#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> l;
int dfs(int a, int b, int c, int i) {
  if (i == N) {
    if (a == 0 || b == 0 || c == 0) return 1000000;
    return abs(a - A) + abs(b - B) + abs(c - C) - 30;
  }
  int choose_A = dfs(a + l[i], b, c, i + 1) + 10;
  int choose_B = dfs(a, b + l[i], c, i + 1) + 10;
  int choose_C = dfs(a, b, c + l[i], i + 1) + 10;
  int choose_none = dfs(a, b, c, i + 1);
  return min({choose_A, choose_B, choose_C, choose_none});
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = 0; i < N; ++i) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
