#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = long long(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long a, b, c, n;
vector<long long> l;
long long dfs(int k, int ap, int bp, int cp, long long point) {
  if (k == n) {
    return abs(ap - a) + abs(bp - b) + abs(cp - c) + point;
  }
  long long ans = LINF;
  if (ap == 0)
    chmin(ans, dfs(k + 1, ap + l[k], bp, cp, point));
  else
    chmin(ans, dfs(k + 1, ap + l[k], bp, cp, point + 10));
  if (bp == 0)
    chmin(ans, dfs(k + 1, ap, bp + l[k], cp, point));
  else
    chmin(ans, dfs(k + 1, ap, bp + l[k], cp, point + 10));
  if (cp == 0)
    chmin(ans, dfs(k + 1, ap, bp, cp + l[k], point));
  else
    chmin(ans, dfs(k + 1, ap, bp, cp + l[k], point + 10));
  chmin(ans, dfs(k + 1, ap, bp, cp, point));
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    l.push_back(temp);
  }
  cout << dfs(0, 0, 0, 0, 0) << "\n";
}
