#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int obj[3];
int stick[8];
int Min = 99999999;
int dp(int a, int b, int c, int used) {
  int res = 99999999;
  if (a != 0 && b != 0 && c != 0) {
    res = abs(A - a) + abs(B - b) + abs(C - c) - 30;
    if (res > Min) return 99999999;
  }
  if (used == (1 << N)) return 99999999;
  for (int i = 0; i < N; i++) {
    if (((used >> i) & 1) == 1) {
      continue;
    }
    res = min(res, dp(a + stick[i], b, c, (used | (1 << i))) + 10);
    res = min(res, dp(a, b + stick[i], c, (used | (1 << i))) + 10);
    res = min(res, dp(a, b, c + stick[i], (used | (1 << i))) + 10);
  }
  Min = min(Min, res);
  return res;
}
int main() {
  int i;
  cin >> N >> A >> B >> C;
  for (i = 0; i < N; i++) {
    cin >> stick[i];
  }
  int ans = dp(0, 0, 0, 0);
  cout << ans;
  return 0;
}
