#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> L;
int A, B, C;
int ans = 1e9;
void dfs(int depth, int a, int b, int c, int mp) {
  if (depth == N) {
    if (a > 0 && b > 0 && c > 0) {
      mp += abs(a - A) + abs(b - B) + abs(c - C);
      ans = min(ans, mp - 30);
    } else {
      return;
    }
  }
  dfs(depth + 1, a + L[depth], b, c, mp + 10);
  dfs(depth + 1, a, b + L[depth], c, mp + 10);
  dfs(depth + 1, a, b, c + L[depth], mp + 10);
  dfs(depth + 1, a, b, c, mp);
}
int main() {
  cin >> N >> A >> B >> C;
  L.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  dfs(0, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
