#include <bits/stdc++.h>
using namespace std;
int n, a[10], ans = 1000000000, target1, target2, target3;
void DFS(int i, int sum1, int sum2, int sum3, int cost) {
  if (i > n) {
    ans = min(ans, abs(target1 - sum1) + abs(target2 - sum2) +
                       abs(target3 - sum3) + cost);
  } else {
    DFS(i + 1, sum1, sum2, sum3, cost);
    DFS(i + 1, sum1 + a[i], sum2, sum3, cost + 10);
    DFS(i + 1, sum1, sum2 + a[i], sum3, cost + 10);
    DFS(i + 1, sum1, sum2, sum3 + a[i], cost + 10);
  }
}
int main() {
  cin >> n >> target1 >> target2 >> target3;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  DFS(1, 0, 0, 0, 0);
  cout << ans - 30;
}
