#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int in() {
  int x;
  cin >> x;
  return x;
}
long long lin() {
  long long x;
  cin >> x;
  return x;
}
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;
}
template <class T>
inline void print(pair<T, T> p) {
  cout << "(" << p.first << "," << p.second << ") ";
}
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}
const long long INF = 1e9 + 7;
long long n, a, b, c;
vector<long long> l;
long long dfs(long long N, long long A, long long B, long long C) {
  long long rec = abs(A - a) + abs(B - b) + abs(C - c);
  if (N > 0) {
    rec = min(rec, dfs(N - 1, A + l[N - 1], B, C) + 10);
    rec = min(rec, dfs(N - 1, A, B + l[N - 1], C) + 10);
    rec = min(rec, dfs(N - 1, A, B, C + l[N - 1]) + 10);
    rec = min(rec, dfs(N - 1, A, B, C));
  }
  return rec;
}
int main() {
  cin >> n >> a >> b >> c;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    l.push_back(x);
  }
  cout << dfs(n, 0LL, 0LL, 0LL) - 30 << endl;
  return 0;
}
