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