#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
int n, a, b, c;
vector<int> l;
int dfs(int cur = 0, int x = 0, int y = 0, int z = 0) {
  if (cur == n) {
    if (!x || !b || !c) return Inf;
    return abs(x - a) + abs(y - b) + abs(z - c) - 30;
  }
  int res = Inf;
  res = min(res, dfs(cur + 1, x + l[cur], y, z) + 10);
  res = min(res, dfs(cur + 1, x, y + l[cur], z) + 10);
  res = min(res, dfs(cur + 1, x, y, z + l[cur]) + 10);
  res = min(res, dfs(cur + 1, x, y, z));
  return res;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(0);
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int i = 0; i < (int)n; ++i) cin >> l[i];
  cout << dfs() << endl;
  return 0;
}
