#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, A, B, C;
int dfs(int pos, int a, int b, int c) {
  if (pos == n) {
    if (min({a, b, c}) >= 0)
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    else
      return 1e6;
  }
  int q = dfs(pos + 1, a, b, c), w = dfs(pos + 1, a + v[pos], b, c) + 10,
      e = dfs(pos + 1, a, b + v[pos], c) + 10,
      r = dfs(pos + 1, a, b, c + v[pos]) + 10;
  return min({q, w, e, r});
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> A >> B >> C;
  v.resize(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  cout << dfs(0, 0, 0, 0);
}
