#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
const auto INF = 1000000000;
auto l = vector<int>();
int dfs(int i, int a, int b, int c) {
  if (N == i) {
    if (min({a, b, c}) > 0) {
      return (A - a) + (B - b) + (C - c) - 30;
    } else {
      return INF;
    }
  }
  auto t0 = dfs(i + 1, a, b, c);
  auto t1 = dfs(i + 1, a + l[i], b, c) + 10;
  auto t2 = dfs(i + 1, a, b + l[i], c) + 10;
  auto t3 = dfs(i + 1, a, b, c + l[i]) + 10;
  return min({t0, t1, t2, t3});
}
int main() {
  cin >> N >> A >> B >> C;
  for (size_t i = 0; i < N; i++) {
    int num;
    cin >> num;
    l.push_back(num);
  }
  cout << dfs(0, 0, 0, 0);
}
