#include <bits/stdc++.h>
using namespace std;
int ans = 0x3f3f3f3f, a, b, c, l[100];
int n;
inline void dfs(int pos, int A, int B, int C, int res) {
  if (pos > n) {
    ans = min(ans, res + abs(a - A) + abs(B - b) + abs(C - c));
    return;
  }
  dfs(pos + 1, A + l[pos], B, C, res + (A != 0) * 10);
  dfs(pos + 1, A, B + l[pos], C, res + (B != 0) * 10);
  dfs(pos + 1, A, B, C + l[pos], res + (C != 0) * 10);
  dfs(pos + 1, A, B, C, res);
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 1; i <= n; ++i) cin >> l[i];
  sort(l + 1, l + n + 1);
  dfs(1, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
