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