#include <bits/stdc++.h>
using namespace std;
long long INF = 1e18;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int N, M;
int A, B, C;
int ans = 101000;
int L[10];
int dfs(int k, int a, int b, int c) {
  if (k == N) {
    if (min(a, min(b, c)) == 0) {
      return 101000;
    } else {
      return abs(a - A) + abs(b - B) + abs(c - C);
    }
  }
  ans = min(ans, dfs(k + 1, a + L[k], b, c) + (a > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b + L[k], c) + (b > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b, c + L[k]) + (c > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b, c));
  return ans;
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
