#include <bits/stdc++.h>
using namespace ::std;
inline string replace(string str, string before, std::string after) {
  string::size_type Pos(str.find(before));
  while (Pos != std::string::npos) {
    str.replace(Pos, before.length(), after);
    Pos = str.find(before, Pos + after.length());
  }
  return str;
}
inline vector<string> split(string &s, string delim) {
  vector<string> elems;
  s = replace(s, "#", "HASH");
  s = replace(s, delim, "#");
  stringstream ss(s);
  string item;
  while (getline(ss, item, '#')) {
    elems.push_back(replace(item, "HASH", "#"));
  }
  return elems;
}
inline vector<int> cross(vector<int> a, vector<int> b) {
  return {a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
          a[0] * b[1] - a[1] * b[0]};
}
inline int GCD(int a, int b) {
  if (a < b) swap(a, b);
  if (a % b != 0)
    GCD(b, a % b);
  else
    return b;
}
inline vector<long long> primeList(long long n) {
  vector<bool> p(n + 1);
  vector<long long> list;
  for (long long i = long long(1); i < long long(n + 1); i++) p[i] = true;
  for (long long i = long long(2); i < long long(sqrt(n) + 1); i++) {
    if (p[i]) {
      for (long long j = long long(2); j < long long(n / i + 1); j++) {
        p[i * j] = false;
      }
    }
  }
  for (long long i = long long(2); i < long long(n + 1); i++)
    if (p[i]) list.push_back(i);
  return list;
}
inline bool isPrime(int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }
  return true;
}
template <typename T>
class Stack {
  vector<T> stack;

 public:
  void push(T num) { stack.push_back(num); }
  T pop() {
    T num = stack[stack.size() - 1];
    stack.erase(stack.end() - 1);
    return num;
  }
  bool empty() { return stack.empty(); }
};
template <typename T>
class Queue {
  deque<T> queue;

 public:
  void push(T num) { queue.push_front(num); }
  void push_back(T num) { queue.push_back(num); }
  T pop() {
    T num = queue[queue.size() - 1];
    queue.pop_back();
    return num;
  }
  bool empty() { return queue.empty(); }
};
inline vector<long long> decimalConversion(long long val, long long n) {
  vector<long long> v;
  while (1) {
    if (val == 0) break;
    v.push_back(val % n);
    val %= n;
  }
  reverse((v).begin(), (v).end());
  return v;
}
inline vector<long long> decimalConversion(long long val, long long n,
                                           long long size) {
  vector<long long> v;
  while (1) {
    if (val == 0) break;
    v.push_back(val % n);
    val %= n;
  }
  v.resize(n, 0);
  reverse((v).begin(), (v).end());
  return v;
}
struct Data {
 public:
  long long cur, mp, a, b, c;
  Data(long long _cur, long long _mp, long long _a, long long _b,
       long long _c) {
    cur = _cur;
    mp = _mp;
    a = _a;
    b = _b;
    c = _c;
  }
};
int main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long long> l(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> l[i];
  long long min_mp = INT_MAX;
  Stack<Data> s;
  s.push(Data(0, 0, 0, 0, 0));
  while (!s.empty()) {
    Data val = s.pop();
    if (val.cur == n) {
      if (val.a == 0 || val.b == 0 || val.c == 0) continue;
      min_mp = min(min_mp,
                   val.mp + abs(a - val.a) + abs(b - val.b) + abs(c - val.c));
    } else {
      s.push(Data(val.cur + 1, val.mp + (val.a ? 10 : 0), val.a + l[val.cur],
                  val.b, val.c));
      s.push(Data(val.cur + 1, val.mp + (val.b ? 10 : 0), val.a,
                  val.b + l[val.cur], val.c));
      s.push(Data(val.cur + 1, val.mp + (val.c ? 10 : 0), val.a, val.b,
                  val.c + l[val.cur]));
      s.push(Data(val.cur + 1, val.mp, val.a, val.b, val.c));
    }
  }
  (cout << fixed << setprecision(15)) << min_mp << "\n";
}
