#include <bits/stdc++.h>
using namespace std;
vector<int> take;
int n, a, b, c;
int dfs(int depth, int acmb, int bcmb, int ccmb) {
  if (depth == n) {
    if (min({acmb, bcmb, ccmb}) > 0)
      return abs(acmb - a) + abs(bcmb - b) + abs(ccmb - c) - 30;
    else
      return (int)1e9;
  }
  int ret = dfs(depth + 1, a, b, c);
  ret = min(ret,
            dfs(depth + 1, acmb + take[depth], bcmb, ccmb) + (acmb ? 10 : 0));
  ret = min(ret,
            dfs(depth + 1, acmb, bcmb + take[depth], ccmb) + (bcmb ? 10 : 0));
  ret = min(ret,
            dfs(depth + 1, acmb, bcmb, ccmb + take[depth]) + (ccmb ? 10 : 0));
  return ret;
}
int main() {
  cin >> n >> a >> b >> c;
  take.resize(n);
  for (int i = 0; i < n; i++) cin >> take[i];
  cout << dfs(0, 0, 0, 0) << endl;
}
