#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);
ll n, A, B, C;
ll ans = INF;
vector<ll> l(10);
void bfs(int a, int b, int c, int i, int m) {
  if (i == n) {
    if (!a || !b || !c) {
      ans = min(ans, abs(A - a) + abs(B - b) + abs(C - c) + m);
    }
    return;
  }
  bfs(a + l[i], b, c, i + 1, m + 10);
  bfs(a, b + l[i], c, i + 1, m + 10);
  bfs(a, b, c + l[i], i + 1, m + 10);
  bfs(a, b, c, i + 1, m);
}
int main(void) {
  cin >> n >> A >> B >> C;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  cout << ans << endl;
}
