#include <bits/stdc++.h>
using namespace std;
void chmin(int &a, int b) {
  if (a > b) a = b;
}
int A, B, C, N;
int L[1005];
const long long INF = 1e9 + 9;
int rec(int idx, int a, int b, int c) {
  if (idx == N) {
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  int res = rec(idx + 1, a, b, c);
  res = min(res, rec(idx + 1, a + L[idx], b, c) + (a ? 10 : 0));
  res = min(res, rec(idx + 1, a, b + L[idx], c) + (b ? 10 : 0));
  res = min(res, rec(idx + 1, a, b, c + L[idx]) + (c ? 10 : 0));
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> L[i];
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}
