#include <bits/stdc++.h>
using namespace std;
int kadomatsu(int n, int ar[], int a, int b, int c, int suma, int sumb,
              int sumc, int i) {
  if (i == n) {
    if (!suma || !sumb || !sumc) {
      return 0;
    }
    return abs(a - suma) + abs(b - sumb) + abs(c - sumc);
  }
  int o1 = kadomatsu(n, ar, a, b, c, suma, sumb, sumc, i + 1);
  int o2 = kadomatsu(n, ar, a, b, c, suma + ar[i], sumb, sumc, i + 1) +
           (suma ? 10 : 0);
  int o3 = kadomatsu(n, ar, a, b, c, suma, sumb + ar[i], sumc, i + 1) +
           (sumb ? 10 : 0);
  int o4 = kadomatsu(n, ar, a, b, c, suma, sumb, sumc + ar[i], i + 1) +
           (sumc ? 10 : 0);
  return min(o1, min(o2, min(o3, o4)));
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  int k = kadomatsu(n, ar, a, b, c, 0, 0, 0, 0);
  cout << k << endl;
}
