#include <bits/stdc++.h>
using namespace std;
vector<int> l;
int ia, ib, ic;
int solve(int a, int b, int c, int index, int cost) {
  if (index == l.size())
    if (ia == a || ib == b || ic == c)
      return 112345678;
    else
      return abs(a) + abs(b) + abs(c) + cost;
  vector<int> ans = {solve(a - l[index], b, c, index + 1, cost + 10),
                     solve(a, b - l[index], c, index + 1, cost + 10),
                     solve(a, b, c - l[index], index + 1, cost + 10),
                     solve(a, b, c, index + 1, cost + 10)};
  sort(ans.begin(), ans.end());
  return ans[0];
}
int main(void) {
  int n;
  cin >> n >> ia >> ib >> ic;
  for (int i = (0); i < (n); ++i) {
    int x;
    cin >> x;
    l.push_back(x);
  }
  cout << solve(ia, ib, ic, 0, -30) << endl;
  return 0;
}
