#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 N, A, B, C;
vector<int> l;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int rec(int i, int a, int b, int c) {
  if (i == N) {
    if (!a || !b || !c) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  int res = rec(i + 1, a, b, c);
  chmin(res, rec(i + 1, a + l[i], b, c) + (a ? 10 : 0));
  chmin(res, rec(i + 1, a, b + l[i], c) + (b ? 10 : 0));
  chmin(res, rec(i + 1, a, b, c + l[i]) + (c ? 10 : 0));
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (auto &it : l) cin >> it;
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}
