#include <bits/stdc++.h>
using namespace std;
long long n;
long long A, B, C;
vector<long long> l;
long long dfs(long long cur, long long a, long long b, long long c) {
  if (cur == n) {
    if (a != 0 && b != 0 && c != 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else {
      return 3000;
    }
  }
  long long ret = LONG_LONG_MAX;
  ret = min(ret, 10 + dfs(cur + 1, a + l[cur], b, c));
  ret = min(ret, 10 + dfs(cur + 1, a, b + l[cur], c));
  ret = min(ret, 10 + dfs(cur + 1, a, b, c + l[cur]));
  ret = min(ret, 10 + dfs(cur + 1, a, b, c));
  return ret;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  cin >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
