#include <bits/stdc++.h>
using namespace std;
static const long long INF = 1e18;
static const long long MAX = 101010;
static const long long MOD = 1e9 + 7;
static const long long LOGN = 55;
int main(void) {
  long long N, K[3];
  cin >> N >> K[0] >> K[1] >> K[2];
  long long i, j;
  long long ans = INF;
  long long l[11];
  for (i = 0; i < N; i++) cin >> l[i];
  for (long long S = 0; S < pow(4, N); S++) {
    vector<long long> g[4];
    long long s[3] = {};
    long long t = S;
    for (i = 0; i < N; i++) {
      long long id = t % 4;
      t /= 4;
      g[id].push_back(i);
      if (id == 3) continue;
      s[id] += l[i];
    }
    long long cost = 0;
    for (i = 0; i < 3; i++) {
      cost += abs(s[i] - K[i]);
      cost += 10 * ((long long)g[i].size() - 1);
    }
    {
      if (ans > cost) ans = cost;
    };
  }
  cout << ans << "\n";
}
