#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int MAX = 510000;
const double pi = acos(-1);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int n, A, B, C;
int l[8];
int v = 1e9;
void dfs(int cost, int num, int a, int b, int c) {
  if (num == n) {
    if (a == 0 && b == 0 && c == 0) return;
    cost += abs(a - A) + abs(b - B) + abs(c - C) - 30;
    chmin(v, cost);
    return;
  }
  dfs(cost + 10, num + 1, a + l[num], b, c);
  dfs(cost + 10, num + 1, a, b + l[num], c);
  dfs(cost + 10, num + 1, a, b, c + l[num]);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> A >> B >> C;
  for (long long i = 0; i < (long long)(n); i++) cin >> l[i];
  dfs(0, 0, 0, 0, 0);
  cout << v << endl;
  return 0;
}
