#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> L(N + 1);
  L[0] = 0;
  for (int i = 0; i < (int)(N); i++) {
    cin >> L[i + 1];
  }
  for (int i = 0; i < (int)(N); i++) {
    L[i + 1] += L[i];
  }
  int nums[3] = {0, 1, 2};
  int take[3] = {A, B, C};
  int ans = 1e9;
  do {
    vector<int> LL = L;
    int tmp = 0;
    for (int i = 0; i < (int)(3); i++) {
      int l, r, d;
      d = 1e9;
      for (int j = 0; j < LL.size(); j++) {
        for (int k = j + 1; k < LL.size(); k++) {
          int diff = abs(take[nums[i]] - (LL[k] - LL[j]));
          if (diff < d) {
            d = diff;
            l = j;
            r = k;
          }
        }
      }
      vector<int> LLL;
      for (int i = 0; i < LL.size(); i++) {
        if (i >= l + 1 && i <= r)
          continue;
        else
          LLL.push_back(LL[i]);
      }
      LL = LLL;
      tmp += (r - l - 1) * 10 + d;
    }
    ans = min(ans, tmp);
  } while (next_permutation(nums, nums + 3));
  cout << ans << endl;
}
