#include <bits/stdc++.h>
using namespace std;
long long N;
long long l[10];
long long a, b, c;
long long dfs(string s) {
  long long res = 1000000000000000000;
  if (s.size() == N) {
    long long ta = 0, tb = 0, tc = 0;
    long long cnt = N;
    for (long long i = 0; i < N; i++) {
      if (s[i] == '0') ta += l[i];
      if (s[i] == '1') tb += l[i];
      if (s[i] == '2')
        tc += l[i];
      else
        cnt--;
    }
    if (ta == 0 || tb == 0 || tc == 0) return 1000000000000000000;
    if (cnt < 3) return 1000000000000000000;
    return abs(ta - a) + abs(tb - b) + abs(tc - c) + 10 * (cnt - 3);
  }
  for (char c = '0'; c < '4'; c++) (res > dfs(s + c) ? res = dfs(s + c) : 0);
  return res;
}
int main(void) {
  cin >> N;
  cin >> a >> b >> c;
  for (long long i = 0; i < N; i++) cin >> l[i];
  cout << dfs("") << "\n";
}
