#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int n, a, b, c;
vector<int> l(10);
int ans = INT_MAX;
int f(vector<int> v) {
  int x = 0;
  int y = 0;
  int z = 0;
  int d = 0;
  for (int i = 0; i < (v.size()); i++) {
    if (v[i] == 0) {
      x += l[i];
      d++;
    }
    if (v[i] == 1) {
      y += l[i];
      d++;
    }
    if (v[i] == 2) {
      z += l[i];
      d++;
    }
  }
  return abs(a - x) + abs(b - y) + abs(c - z) + 10 * (d - 3);
}
int dfs(int depth, vector<int> v) {
  if (depth == n) ans = min(ans, f(v));
  for (int i = 0; i < (4); i++) {
    v[depth] = i;
    dfs(depth + 1, v);
  }
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < (n); i++) cin >> l[i];
  vector<int> v;
  dfs(0, v);
  return 0;
}
