#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int n, a, b, c;
int l[10];
int INF = pow(10, 9);
int dfs(int ret, int alen, int blen, int clen) {
  if (ret == n) {
    if (min({a, b, c}) > 0)
      return abs(alen - a) + abs(blen - b) + abs(clen - c) - 30;
    else
      return INF;
  }
  int pat0 = dfs(ret + 1, alen, blen, clen);
  int pat1 = dfs(ret + 1, alen + l[ret], blen, clen) + 10;
  int pat2 = dfs(ret + 1, alen, blen + l[ret], clen) + 10;
  int pat3 = dfs(ret + 1, alen, blen, clen + l[ret]) + 10;
  return min({pat0, pat1, pat2, pat3});
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i <= n - 1; i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
}
