#include <bits/stdc++.h>
using namespace std;
vector<int> v(9, 0);
vector<int> l(9, 0);
int ans = 10000000;
int A, B, C;
int N;
void calc() {
  int a = 0, b = 0, c = 0;
  int mp = 0;
  for (int i = 0; i < N; ++i) {
    if (v[i] == 1) {
      if (a != 0) mp += 10;
      a += l[i];
    } else if (v[i] == 2) {
      if (b != 0) mp += 10;
      b += l[i];
    } else if (v[i] == 3) {
      if (c != 0) mp += 10;
      c += l[i];
    }
  }
  mp += abs(A - a) + abs(B - b) + abs(C - c);
  ans = min(ans, mp);
}
void dfs(int depth) {
  if (depth == N) {
    calc();
    return;
  }
  for (int i = 0; i < 4; ++i) {
    v[depth] = i;
    dfs(depth + 1);
  }
}
int main() {
  cin >> N;
  cin >> A >> B >> C;
  for (int i = 0; i < N; ++i) cin >> l[i];
  dfs(0);
  cout << ans << endl;
  return 0;
}
