#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, l[1000];
int dfs(int k, int a1, int b1, int c1) {
  if (k == n) {
    return abs(a - a1) + abs(b - b1) + abs(c - c1);
  }
  int ans1 = (a1 == 0) ? dfs(k + 1, a1 + l[k], b1, c1)
                       : dfs(k + 1, a1 + l[k], b1, c1) + 10;
  int ans2 = (b1 == 0) ? dfs(k + 1, a1, b1 + l[k], c1)
                       : dfs(k + 1, a1, b1 + l[k], c1) + 10;
  int ans3 = (c1 == 0) ? dfs(k + 1, a1, b1, c1 + l[k])
                       : dfs(k + 1, a1, b1, c1 + l[k]) + 10;
  int ans4 = dfs(k + 1, a1, b1, c1);
  return min(min(ans1, ans2), min(ans3, ans4));
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << "\n";
}
