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