#include <bits/stdc++.h>
using namespace std;
pair<int, int> solve(vector<int> &vl, int a, int state) {
  pair<int, int> ans{-1, -1};
  for (int i = 1; i < (1 << vl.size()); ++i) {
    if (state & i) {
      continue;
    }
    int sum = 0, cnt = 0;
    for (int j = 0; j < vl.size(); ++j) {
      if (i & (1 << j)) {
        sum += vl[j];
        cnt++;
      }
    }
    int mp = abs(sum - a) + (cnt - 1) * 10;
    if (ans.first < 0 || mp < ans.first) {
      ans.first = mp;
      ans.second = state | i;
    }
  }
  return ans;
}
int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> abc(3);
  for (int i = 0; i < 3; ++i) {
    cin >> abc[i];
  }
  vector<int> vl(n);
  for (int i = 0; i < n; ++i) {
    cin >> vl[i];
  }
  int ans = -1;
  for (int i = 0; i < vl.size(); ++i) {
    for (int j = 0; j < vl.size(); ++j) {
      if (i == j) {
        continue;
      }
      for (int k = 0; k < vl.size(); ++k) {
        if (k == i || k == j) {
          continue;
        }
        int l_ans = 0, state = 0;
        vector<int> tmp{abc[i], abc[j], abc[k]};
        for (int idx = 0; idx < tmp.size(); ++idx) {
          auto res = solve(vl, tmp[idx], state);
          l_ans += res.first;
          state |= res.second;
        }
        if (ans == -1 || l_ans < ans) {
          ans = l_ans;
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
