#include <bits/stdc++.h>
const int MOD = 1000000007, INF = 1111111111;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  vector<int> G(3);
  cin >> N >> G[0] >> G[1] >> G[2];
  vector<int> len(N);
  for (int i = 0; i < N; i++) cin >> len[i];
  int cnt, tmp, bit = (1 << N) - 1, bitmp;
  vector<int> ans(3, INF);
  for (int k = 0; k < 3; k++) {
    for (int i = 1; i < (1 << N); i++) {
      cnt = -1, tmp = 0;
      for (int j = 0; j < N; j++) {
        if (i & (1 << j) & bit) {
          cnt++;
          tmp += len[j];
        }
      }
      if (!tmp) continue;
      if (ans[k] > abs(tmp - G[k]) + cnt * 10) {
        ans[k] = abs(tmp - G[k]) + cnt * 10;
        bitmp = ~i;
      }
    }
    bit &= bitmp;
    ((void)0);
  }
  cout << ans[0] + ans[1] + ans[2] << "\n";
  return 0;
}
