#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const int INF = 2000000001;
const long long int INFll = 2e18;
const double Micro = 1e-5;
int UnUsedVariable() {
  if (INF || Micro || MOD || INFll || MOD2) {
    ;
  }
  return 0;
}
inline int isEven(int x) { return x % 2 == 0; }
inline int isOdd(int x) { return x % 2 == 1; }
inline long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
inline long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
int EintN(long long int array[], const long long int num) {
  for (int i = 0; i < num; i++) {
    cerr << array[i] << " ";
  }
  printf("\n");
  ;
  return 0;
}
int EintNN(const int heighth, const int width, int array[heighth][width]) {
  for (int i = (0); i < (heighth); i++) {
    for (int k = (0); k < (width); k++) {
      { cerr << array[i][k] << " "; }
    }
    printf("\n");
    ;
  }
  printf("\n");
  ;
  return 0;
}
int Eint(string str, const long long int num) {
  cerr << str << " is " << num << " now." << endl;
  return 0;
}
long long int bamboo[8];
long long int N, A, B, C;
long long int re(long long int num, long long int useA, long long int useB,
                 long long int useC) {
  if (num == N) {
    if ((min)({useA, useB, useC}) == 0)
      return INF;
    else
      return abs(A - useA) + abs(B - useB) + abs(C - useC) - 30;
  }
  long long int ans0 = re(num + 1, useA, useB, useC);
  long long int ans1 = re(num + 1, useA + bamboo[num], useB, useC) + 10;
  long long int ans2 = re(num + 1, useA, useB + bamboo[num], useC) + 10;
  long long int ans3 = re(num + 1, useA, useB, useC + bamboo[num]) + 10;
  return (min)({ans0, ans1, ans2, ans3});
}
int prob() {
  long long int ans;
  ans = 0;
  cin >> N >> A >> B >> C;
  for (int i = (0); i < (N); i++) {
    cin >> bamboo[i];
  };
  {
    cout << (re(0, 0, 0, 0)) << endl;
    return 0;
  };
  return 0;
}
signed main() {
  prob();
  return 0;
}
