#include <bits/stdc++.h>
using namespace std;
int N;
int A, B, C;
vector<int> ls;
void chmin(int& x, int y) {
  if (x > y) x = y;
}
int dfs(int used, int a, int b, int c) {
  if (used == N) {
    if (a == 0 || b == 0 || c == 0) {
      return 1000000000;
    } else {
      return abs(a - A) + abs(b - B) + abs(c - C);
    }
  }
  int ret = 1000000000;
  chmin(ret, dfs(used + 1, a + ls[used], b, c) + 10);
  chmin(ret, dfs(used + 1, a, b + ls[used], c) + 10);
  chmin(ret, dfs(used + 1, a, b, c + ls[used]) + 10);
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  N = n;
  A = a, B = b, C = c;
  ls.resize(N);
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    ls[i] = l;
  }
  int ans = dfs(0, 0, 0, 0);
  cout << ans << endl;
}
