#include <bits/stdc++.h>
using namespace std;
using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;
using sc = signed char;
using si = signed int;
using sl = signed long long int;
const static ul NMAX = 8;
const static ul LiMAX = 1000;
static si N, A, B, C;
static si Li[NMAX];
si dfs(si i, si a, si b, si c) {
  if (i == N) {
    if (min(a, min(b, c)) > 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else {
      return LiMAX;
    }
  }
  si r1, r2, r3, r4;
  r1 = dfs(i + 1, a, b, c);
  r2 = dfs(i + 1, a + Li[i], b, c) + 10;
  r3 = dfs(i + 1, a, b + Li[i], c) + 10;
  r4 = dfs(i + 1, a, b, c + Li[i]) + 10;
  return min(min(r1, r2), min(r3, r4));
}
void solve(void) { cout << dfs(0, 0, 0, 0) << endl; }
int main(void) {
  cin >> N >> A >> B >> C;
  for (ul(i) = 0; (i) < (N); ++(i)) {
    cin >> Li[i];
  }
  solve();
  return 0;
}
