#include <bits/stdc++.h>
using namespace std;
int INF = 1001001001;
int N, A, B, C;
vector<int> v;
int dfs(int n, int a, int b, int c) {
  if (n == N) {
    if (a > 0 && b > 0 && c > 0) {
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    } else
      return INF;
  }
  int ret0 = dfs(n + 1, a, b, c);
  int ret1 = dfs(n + 1, a + v[n], b, c) + 10;
  int ret2 = dfs(n + 1, a, b + v[n], c) + 10;
  int ret3 = dfs(n + 1, a, b, c + v[n]) + 10;
  return min({ret0, ret1, ret2, ret3});
}
int main(void) {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < (N); i++) {
    int s;
    cin >> s;
    v.push_back(s);
  }
  cout << (dfs(0, 0, 0, 0)) << endl;
  ;
}
