#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
int n, p, d, q;
vector<pair<int, int> > G[maxn];
int a[10], l[3], vis[10];
int ans = 1000000000;
void dfs(int id, int anser) {
  if (vis[0] == 1 && vis[1] == 1 && vis[2] == 1) {
    ans = min(ans, anser);
    return;
  }
  if (id >= n) return;
  for (int i = 0; i < 3; ++i) {
    if (!vis[i]) {
      vis[i] = true;
      dfs(id + 1, anser + abs(a[id] - l[i]));
      vis[i] = false;
      dfs(id + 1, anser);
      for (int j = id + 1; j < n; ++j) {
        a[j] += a[id];
        dfs(j, anser + 10);
        a[j] -= a[id];
      }
    }
  }
}
int main() {
  cin >> n >> l[0] >> l[1] >> l[2];
  sort(l, l + 3);
  for (int i = 0; i < n; ++i) cin >> a[i];
  dfs(0, 0);
  cout << ans << endl;
  return 0;
}
