#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(10);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int ans = 100000000;
  for (int bit = 1; bit < (1 << n); bit++) {
    for (int bit2 = 1; bit2 < (1 << n); bit2++) {
      for (int bit3 = 1; bit3 < (1 << n); bit3++) {
        int cnt = 0, aa = 0, bb = 0, cc = 0;
        for (int i = 0; i < n; i++) {
          if (bit & (1 << i) && bit2 & (1 << i)) break;
          if (bit3 & (1 << i) && bit2 & (1 << i)) break;
          if (bit & (1 << i) && bit3 & (1 << i)) break;
          if (bit & (1 << i)) {
            if (aa > 0) cnt += 10;
            aa += l[i];
          }
          if (bit2 & (1 << i)) {
            if (bb > 0) cnt += 10;
            bb += l[i];
          }
          if (bit3 & (1 << i)) {
            if (cc > 0) cnt += 10;
            cc += l[i];
          }
        }
        cnt += abs(a - aa) + abs(b - bb) + abs(c - cc);
        ans = min(ans, cnt);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
