#include <bits/stdc++.h>
const long long LINF = 1e18;
const int INF = 1e8;
using namespace std;
int n, a, b, c;
vector<int> l;
int search(int used, int a_, int b_, int c_) {
  if (used == n) {
    if (min({a, b, c}))
      return abs(a - a_) + abs(b - b_) + abs(c - c_) - 30;
    else
      return INF;
  }
  int ans1 = search(used + 1, a_, b_, c_);
  int ans2 = search(used + 1, a_ + l[used], b_, c_) + 10;
  int ans3 = search(used + 1, a_, b_ + l[used], c_) + 10;
  int ans4 = search(used + 1, a_, b_, c_ + l[used]) + 10;
  return min({ans1, ans2, ans3, ans4});
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c;
  int tmp;
  for (int i = 0; i < (n); i++) {
    cin >> tmp;
    l.push_back(tmp);
  }
  int ans = search(0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
