#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int n, a, b, c;
int l[10];
int mn = 1000000000;
int ans;
int cal(int num, int x, int y, int z) {
  if (num == n) {
    if (min(x, min(y, z))) {
      ans = abs(x - a) + abs(y - b) + abs(z - c);
      return ans;
    } else
      return 1000000000;
  } else {
    mn = 1000000000;
    mn = min(mn, cal(num + 1, x, y, z));
    mn = min(mn, cal(num + 1, x + l[num], y, z) + (x > 0 ? 10 : 0));
    mn = min(mn, cal(num + 1, x, y + l[num], z) + (y > 0 ? 10 : 0));
    mn = min(mn, cal(num + 1, x, y, z + l[num]) + (z > 0 ? 10 : 0));
    return mn;
  }
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int res = 0;
  res = cal(0, 0, 0, 0);
  cout << res << endl;
}
