#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a, b, c;
int l[8];
int dfs(int i, int A, int B, int C);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> a >> b >> c;
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << "\n";
  ;
  return 0;
}
int dfs(int i, int A, int B, int C) {
  if (i == n) {
    if (a != 0 && b != 0 && c != 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else {
      return ((long long)1e9 + 7);
    }
  }
  int res1 = dfs(i + 1, A, B, C);
  int res2 = dfs(i + 1, A + l[i], B, C) + 10;
  int res3 = dfs(i + 1, A, B + l[i], C) + 10;
  int res4 = dfs(i + 1, A, B, C + l[i]) + 10;
  return min({res1, res2, res3, res4});
}
