#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long M = 1000000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                         {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};
int n, a, b, c, l[30];
int ret = INF;
int solve(int a, vector<int> v) {
  int sum = 0;
  int ret0 = 0;
  for (int i = 0; i < v.size(); i++) {
    ret0 += 10;
    sum += v[i];
  }
  ret0 -= 10;
  ret0 += abs(sum - a);
  return ret0;
}
void dfs(int i, int use[20]) {
  if (i == n) {
    vector<int> vs[4];
    for (int j = 0; j < n; j++) {
      if (use[j] == 0) {
        vs[0].push_back(l[j]);
      } else if (use[j] == 1) {
        vs[1].push_back(l[j]);
      } else if (use[j] == 2) {
        vs[2].push_back(l[j]);
      } else if (use[j] == 3) {
        vs[3].push_back(l[j]);
      }
    }
    int sum0 = 0;
    sum0 += solve(a, vs[1]);
    sum0 += solve(b, vs[2]);
    sum0 += solve(c, vs[3]);
    ret = min(sum0, ret);
    return;
  }
  use[i] = 0;
  dfs(i + 1, use);
  use[i] = 1;
  dfs(i + 1, use);
  use[i] = 2;
  dfs(i + 1, use);
  use[i] = 3;
  dfs(i + 1, use);
  return;
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  int u[20];
  dfs(0, u);
  cout << ret;
  cout << endl;
  return 0;
}
