#include <bits/stdc++.h>
using namespace std;
const long long inf = 1LL << 58;
vector<long long> a;
long long solve(int depth, vector<long long> v) {
  if (depth == 3) return v.empty() ? 0 : inf;
  long long ans = inf;
  for (int i = 1; i < 1 << v.size(); ++i) {
    vector<long long> nxtv;
    long long sum = 0;
    for (int j = 0; j < v.size(); ++j) {
      if (!((i >> j) & 1))
        nxtv.push_back(v[j]);
      else
        sum += v[j];
    }
    long long res = solve(depth + 1, nxtv);
    ans = min(ans, res + abs(sum - a[depth]));
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  a = vector<long long>(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];
  vector<long long> L(N);
  for (int i = 0; i < N; ++i) cin >> L[i];
  long long ans = solve(0, L);
  cout << ans + 10 * (N - 3) << endl;
  return 0;
}
