#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e9;
int n, A, B, C, D;
vector<int> l(8);
int solve(int i, int a, int b, int c) {
  if (i == n) {
    if (a == 0 && b == 0 && c == 0)
      return INF;
    else
      return abs(a - A) + abs(B - b) + abs(C - c);
  }
  int ans = solve(i + 1, a, b, c);
  int adda = 0, addb = 0, addc = 0;
  if (a != 0) adda = 10;
  if (b != 0) addb = 10;
  if (c != 0) addc = 10;
  ans = min(solve(i + 1, a + l[i], b, c) + adda, ans);
  ans = min(solve(i + 1, a, b + l[i], c) + addb, ans);
  ans = min(solve(i + 1, a, b, c + l[i]) + addc, ans);
  return ans;
}
int main() {
  cin >> n >> A >> B >> C;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  cout << solve(0, 0, 0, 0) << endl;
  return 0;
}
