#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int l[8];
int ans = 9999999;
void dfs(int aa, int bb, int cc, int mp, int t) {
  if (t == n) {
    ans = min(ans, mp + abs(a - aa) + abs(b - bb) + abs(c - cc) - 30);
    return;
  }
  dfs(aa + l[t], bb, cc, mp + 10, t + 1);
  dfs(aa, bb + l[t], cc, mp + 10, t + 1);
  dfs(aa, bb, cc + l[t], mp + 10, t + 1);
  dfs(aa, bb, cc, mp, t + 1);
  return;
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  dfs(0, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
