#include <bits/stdc++.h>
using namespace std;
int N;
int l[100];
int A, B, C;
int ret0, ret1, ret2, ret3;
int dfs(int k, int p, int q, int r) {
  if (k == N) {
    if (min(min(p, q), r) > 0) {
      return abs(p - A) + abs(q - B) + abs(r - C) - 30;
    } else {
      return 10000000;
    }
  }
  ret0 = dfs(k + 1, p, q, r) + 10;
  ret1 = dfs(k + 1, p + l[k], q, r) + 10;
  ret2 = dfs(k + 1, p, q + l[k], r) + 10;
  ret3 = dfs(k + 1, p, q, r + l[k]) + 10;
  return min(min(ret0, ret1), min(ret2, ret3));
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
