#include <bits/stdc++.h>
using namespace std;
static const int INF = 1 << 29;
int N, A, B, C;
int l[8];
int dfs(int a, int b, int c, int i) {
  int minv = INF;
  if (i == N)
    return ((a == 0 || b == 0 || c == 0)
                ? INF
                : abs(a - A) + abs(b - B) + abs(c - C) - 30);
  minv = min(minv, dfs(a + l[i], b, c, i + 1) + 10);
  minv = min(minv, dfs(a, b + l[i], c, i + 1) + 10);
  minv = min(minv, dfs(a, b, c + l[i], i + 1) + 10);
  minv = min(minv, dfs(a, b, c, i + 1) + 10);
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < (int)(N); i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
}
