#include <bits/stdc++.h>
using namespace std;

int r, l, m, n;
vector<int> v;

int dfs(int a, int b, int c, int dep) {
  if(r == dep) {
    return min({a, b, c}) > 0
      ? (abs(a - l) + abs(b - m) + abs(c - n) - 30)
      : 2e9;
  }
  int t = v[dep++];
  int t1 = dfs(a + t, b, c, dep) + 10;
  int t2 = dfs(a, b + t, c, dep) + 10;
  int t3 = dfs(a, b, c + t, dep) + 10;
  int t4 = dfs(a, b, c, dep);
  return min({t1, t2, t3, t4});
}

int main() {
  cin >> r >> l >> m >> n;
  
  v.resize(r);
  for(int i = 0; i < r; i++) {
    cin >> v[i];
  }
  
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}