#include <bits/stdc++.h>
using namespace std;
int dfs(int i, int a, int b, int c, int N, int A[], int L[]) {
  if (i == N) {
    if (a == 0 || b == 0 || c == 0) {
      return INT32_MAX;
    }
    return (abs(a - A[0]) + abs(b - A[1]) + abs(c - A[2]) - 30);
  }
  int ret1 = dfs(i + 1, a, b, c, N, A, L);
  int ret2 = dfs(i + 1, a + L[i], b, c, N, A, L) + 10;
  int ret3 = dfs(i + 1, a, b + L[i], c, N, A, L) + 10;
  int ret4 = dfs(i + 1, a, b, c + L[i], N, A, L) + 10;
  return min(ret1, min(ret2, min(ret3, ret4)));
}
int main() {
  int N;
  cin >> N;
  int A[3];
  cin >> A[0] >> A[1] >> A[2];
  int L[8] = {0};
  for (int i = 0; i < N; ++i) {
    cin >> L[i];
  }
  int ans = dfs(0, 0, 0, 0, N, A, L);
  cout << ans << endl;
  return 0;
}
