#include <bits/stdc++.h>
using namespace std;
int n, A, B, C;
vector<int> l;
int dfs(int curr, int a, int b, int c) {
  if (curr == n) {
    int res = abs(a - A) + abs(b - B) + abs(c - C) - 30;
    return res < 0 ? 1e9 + 5 : res;
  }
  int res1 = dfs(curr + 1, a, b, c);
  int res2 = dfs(curr + 1, a + l[curr], b, c) + 10;
  int res3 = dfs(curr + 1, a, b + l[curr], c) + 10;
  int res4 = dfs(curr + 1, a, b, c + l[curr]) + 10;
  return min({res1, res2, res3, res4});
}
int main() {
  cin >> n >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < n; i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0);
}
