#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> bamboo;
map<int, int> m;
int rec(int a, int b, int c, int index, int mp, int use) {
  if (index == bamboo.size()) {
    if (use == 0b111) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30 + mp;
    } else {
      return INT_MAX;
    }
  }
  int first = bamboo[index];
  int ans1 = rec(a, b, c, index + 1, mp, use);
  int ans2 = rec(a + first, b, c, index + 1, mp + 10, use | 0b100);
  int ans3 = rec(a, b + first, c, index + 1, mp + 10, use | 0b010);
  int ans4 = rec(a, b, c + first, index + 1, mp + 10, use | 0b001);
  return min({ans1, ans2, ans3, ans4});
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int bi;
    cin >> bi;
    bamboo.push_back(bi);
  }
  cout << rec(0, 0, 0, 0, 0, 0) << endl;
}
