#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
using vc = vector<char>;
using vvc = vector<vc>;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
long long A, B, C;
long long dfs(vll &l, long long n, long long a, long long b, long long c,
              long long cu) {
  if (cu == n - 1) {
    if (min(min(a, b), c) > 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else {
      return INF;
    }
  }
  long long w1 = dfs(l, n, a, b, c, cu + 1);
  long long w2 = dfs(l, n, a + l[cu], b, c, cu + 1) + 10;
  long long w3 = dfs(l, n, a, b + l[cu], c, cu + 1) + 10;
  long long w4 = dfs(l, n, a, b, c + l[cu], cu + 1) + 10;
  return min(w1, min(w2, min(w3, w4)));
}
int main() {
  long long n;
  cin >> n >> A >> B >> C;
  vll l(n);
  for (long long i = 0; i < (n); i++) cin >> l[i];
  cout << (dfs(l, n, 0, 0, 0, 0)) << endl;
}
