#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
auto &errStream = cerr;
class CerrDummy {
} cerrDummy;
template <class T>
CerrDummy &operator<<(CerrDummy &cd, const T &) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy &operator<<(CerrDummy &cd,
                      basic_ostream<charTDummy, traitsDummy> &(
                          basic_ostream<charTDummy, traitsDummy> &)) {
  return cd;
}
using pi = pair<ll, ll>;
using vi = vector<ll>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (ll i = ll(0); i < ll((ll)v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, ll suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}
string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}
char *readCharArray() {
  static char buf[3341000];
  static ll bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}
template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}
template <class T>
T Sq(const T &t) {
  return t * t;
}
void Yes(bool ex = true) {
  cout << "YES" << endl;
  if (ex) exit(0);
}
void No(bool ex = true) {
  cout << "NO" << endl;
  if (ex) exit(0);
}
const ll infLL = LLONG_MAX / 3;
const ll inf = infLL;
ll N, A, B, C;
ll ans = INT_MAX;
vi bamboo;
void calc(vi v) {
  ll tmp = 0;
  vi abcd(4, 0), count(4, 0);
  for (ll i = ll(0); i < ll(N); i++) {
    abcd[v[i]] += bamboo[i];
    count[v[i]]++;
  }
  for (ll i = ll(0); i < ll(3); i++) {
    tmp += (count[i] - 1) * 10;
  }
  tmp += abs(A - abcd[0]);
  tmp += abs(B - abcd[1]);
  tmp += abs(C - abcd[2]);
  chmin(ans, tmp);
}
void dfs(ll depth, vi v) {
  if (depth == N) {
    calc(v);
    return;
  }
  for (ll i = 0; i < 4; i++) {
    v[depth] = i;
    dfs(depth + 1, v);
  }
}
signed main() {
  cin >> N >> A >> B >> C;
  vi v(N, 0);
  for (ll i = ll(0); i < ll(N); i++) bamboo.push_back(read());
  dfs(0, v);
  print(ans);
}
