#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> l(N);
int dfs(int n, int a, int b, int c) {
  if (n == N) {
    if (a == 0 or b == 0 or c == 0) {
      return 2e10;
    }
    int tmp = abs(a - A) + abs(b - B) + abs(c - C) - 30;
    return tmp;
  }
  int ans1 = dfs(n + 1, a, b, c);
  int ans2 = dfs(n + 1, a + l[n], b, c) + 10;
  int ans3 = dfs(n + 1, a, b + l[n], c) + 10;
  int ans4 = dfs(n + 1, a, b, c + l[n]) + 10;
  return min({ans1, ans2, ans3, ans4});
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
