#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int res = INF;
int n, a, b, c;
vector<int> take;
void dfs(vector<vector<int>> list, int cnt) {
  if (cnt == n) {
    if (list[0].size() == 0 || list[1].size() == 0 || list[2].size() == 0)
      return;
    int len[3] = {0, 0, 0};
    for (int i = 0; i < (3); i++) {
      for (int j = 0; j < (list[i].size()); j++) {
        len[i] += take[list[i][j]];
      }
    }
    int sum[6];
    sum[0] = abs(len[0] - a) + abs(len[1] - b) + abs(len[2] - c);
    sum[1] = abs(len[0] - a) + abs(len[1] - c) + abs(len[2] - b);
    sum[2] = abs(len[0] - b) + abs(len[1] - a) + abs(len[2] - c);
    sum[3] = abs(len[0] - b) + abs(len[1] - c) + abs(len[2] - a);
    sum[4] = abs(len[0] - c) + abs(len[1] - a) + abs(len[2] - b);
    sum[5] = abs(len[0] - c) + abs(len[1] - b) + abs(len[2] - a);
    for (int i = 0; i < (6); i++) chmin(res, sum[i] + (10 * (n - 3)));
  } else {
    for (int i = 0; i < (3); i++) {
      list[i].push_back(cnt);
      dfs(list, cnt + 1);
      list[i].pop_back();
    }
  }
}
int main() {
  cin >> n >> a >> b >> c;
  take.resize(n);
  for (int i = 0; i < (n); i++) cin >> take[i];
  vector<vector<int>> list(3, vector<int>());
  dfs(list, 0);
  cout << res << ln;
}
