#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge {
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> A(3);
  for (auto &it : A) cin >> it;
  vector<int> l(N);
  for (auto &it : l) cin >> it;
  int res = 1 << 29;
  vector<int> bit(3);
  for (bit[0] = 1; bit[0] < (1 << N); bit[0]++) {
    for (bit[1] = 1; bit[1] < (1 << N); bit[1]++) {
      if (bit[1] & bit[0]) continue;
      for (bit[2] = 1; bit[2] < (1 << N); bit[2]++) {
        if (bit[2] & bit[0]) continue;
        if (bit[2] & bit[0]) continue;
        vector<int> sums(3, 0), nums(3, 0);
        for (int i = 0; i < N; i++) {
          for (int j = 0; j < 3; j++) {
            if (bit[j] & (1 << i)) {
              sums[j] += l[i];
              nums[j]++;
            }
          }
        }
        int score = 0;
        for (int i = 0; i < 3; i++) {
          score += abs(sums[i] - A[i]);
          score += (nums[i] - 1) * 10;
        }
        res = min(res, score);
      }
    }
  }
  cout << res << endl;
  return 0;
}
