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