#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, ans = INT_MAX;
vector<int> l;
void dfs(int x, int i, int j, int k, int mp) {
  if (x == n) {
    if (min(i, min(j, k)) > 0) {
      ans = min(ans, mp + abs(a - i) + abs(b - j) + abs(c - k) - 30);
    }
    return;
  }
  dfs(x + 1, i, j, k, mp);
  dfs(x + 1, i + l[x], j, k, mp + 10);
  dfs(x + 1, i, j + l[x], k, mp + 10);
  dfs(x + 1, i, j, k + l[x], mp + 10);
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  dfs(0, 0, 0, 0, 0);
  cout << ans << endl;
}
