#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
vector<pair<long long int, long long int> > p;
bool pairCompare(const pair<double, long long int>& firstElof,
                 const pair<double, long long int>& secondElof) {
  return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double, long long int>& firstElof,
                       const pair<double, long long int>& secondElof) {
  return firstElof.second < secondElof.second;
}
bool x[100100];
long long int num[100100];
long long int fibl[100100] = {0};
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
long long int fib(long long int a) {
  if (fibl[a] != 0) return fibl[a];
  if (a == 0) {
    return 0;
  } else if (a == 1) {
    return 1;
  }
  return fibl[a] = fib(a - 1) + fib(a - 2);
}
long long int eratosthenes(long long int n) {
  int p = 0;
  for (long long int i = 0; i <= n; ++i) x[i] = true;
  x[0] = x[1] = false;
  for (int i = 2; i <= n; ++i) {
    if (x[i]) {
      p++;
      for (int j = 2 * i; j <= n; j += i) x[j] = false;
    }
    num[i] = p;
  }
  return p;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long int keta(long long int N) {
  int tmp{};
  while (N > 0) {
    tmp += (N % 10);
    N /= 10;
  }
  N = tmp;
  return N;
}
void base_num(long long int data, long long int base) {
  if (data == 0) return;
  long long int next = abs(data) % abs(base);
  if (data < 0) next = (abs(base) - next) % abs(base);
  base_num((data - next) / base, base);
  cout << next;
}
long long int nx[9], n, A, B, C;
long long int dfs(long long int co, long long int a, long long int b,
                  long long int c) {
  long long int r0, r1, r2, r3;
  if (co == n) {
    long long int x = 0;
    if (min(min(a, b), c) > 0) x += 30;
    return abs(a - A) + abs(b - B) + abs(c - C) - x;
  }
  r0 = dfs(co + 1, a, b, c);
  r1 = dfs(co + 1, a + nx[co], b, c) + 10;
  r2 = dfs(co + 1, a, b + nx[co], c) + 10;
  r3 = dfs(co + 1, a, b, c + nx[co]) + 10;
  return min(min(r0, r1), min(r2, r3));
}
int main() {
  cin >> n >> A >> B >> C;
  for (long long int i = 0; i < n; i++) {
    cin >> nx[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
