#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int L[9];
int f(int i, int a, int b, int c) {
  if (i > N) return abs(a) + abs(b) + abs(c);
  int ret = f(i + 1, a, b, c);
  ret = min(ret, f(i + 1, a - L[i], b, c) + 10 * (a != A));
  ret = min(ret, f(i + 1, a, b - L[i], c) + 10 * (b != B));
  ret = min(ret, f(i + 1, a, b, c - L[i]) + 10 * (c != C));
  return ret;
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 1; i <= N; ++i) {
    cin >> L[i];
  }
  cout << f(1, A, B, C) << endl;
}
