#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[3];
  for (int i = 0; i < 3; i++) cin >> A[i];
  int L[8];
  for (int i = 0; i < N; i++) scanf("%d", &L[i]);
  int ans = 1000000000;
  int maxm = 1;
  for (int i = 0; i < N; i++) maxm *= 4;
  for (int m = 0; m < maxm; m++) {
    int tmp = m;
    int tmpAns = 0;
    int tmpLength[3];
    tmpLength[0] = A[0], tmpLength[1] = A[1], tmpLength[2] = A[2];
    for (int i = 0; i < N; i++) {
      if (tmp % 4 != 3) {
        if (tmpLength[tmp % 4] != A[tmp % 4]) tmpAns += 10;
        tmpLength[tmp % 4] -= L[i];
      }
      tmp /= 4;
    }
    for (int i = 0; i < 3; i++) {
      if (tmpLength[i] != A[i])
        tmpAns += abs(tmpLength[i]);
      else
        tmpAns += 1000000000 / 10;
    }
    ans = min(ans, tmpAns);
  }
  cout << ans;
  return 0;
}
