#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
vector<int> l;
int dfs(int pos, int aa, int bb, int cc) {
  if (pos == n) {
    if (min({aa, bb, cc}) > 0) {
      return abs(a - aa) + abs(b - bb) + abs(c - cc) - 30;
    } else {
      return 1 << 9;
    }
  }
  int ret1 = dfs(pos + 1, aa, bb, cc);
  int ret2 = dfs(pos + 1, aa + l[pos], bb, cc) + 10;
  int ret3 = dfs(pos + 1, aa, bb + l[pos], cc) + 10;
  int ret4 = dfs(pos + 1, aa, bb, cc + l[pos]) + 10;
  return min({ret1, ret2, ret3, ret4});
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
