#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[3];
  for (int i = 0; i < (3); i++) cin >> a[i];
  vector<int> l(n);
  for (int i = 0; i < (n); i++) cin >> l[i];
  int ans = 1000000000;
  stack<string> st;
  st.push("");
  while (!st.empty()) {
    string now = st.top();
    st.pop();
    if (now.size() == n) {
      int mp = 0;
      vector<vector<int> > bam(4);
      for (int i = 0; i < (n); i++) {
        bam[now[i]].push_back(l[i]);
      }
      for (int i = 0; i < (4); i++) {
        for (int j = 0; j < (bam[i].size()); j++) {
          printf("bam[%d][%d]:%d\n", i, j, bam[i][j]);
        }
      }
      for (int i = 1; i <= 3; i++) {
        while (bam[i].size() >= 2) {
          bam[i][0] += bam[i][bam[i].back()];
          bam[i].pop_back();
          mp += 10;
        }
      }
      for (int i = 1; i <= 3; i++) {
        if (bam[i].empty()) {
          mp += a[i];
        } else {
          mp += abs(a[i] - bam[i][0]);
        }
      }
      ans = min(ans, mp);
    } else {
      for (int i = 0; i < 4; i++) {
        string next = now + to_string(i);
        st.push(next);
      }
    }
  }
  cout << ans << endl;
}
