#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
int n, a, b, c;
int solve(int l[], int i, int a1, int b1, int c1) {
  if (i == n) {
    return abs(a - a1) + abs(b - b1) + abs(c - c1);
  }
  int ans = solve(l, i + 1, a1, b1, c1);
  ans = min(ans, (a1 ? 10 : 0) + solve(l, i + 1, a1 + l[i], b1, c1));
  ans = min(ans, (b1 ? 10 : 0) + solve(l, i + 1, a1, b1 + l[i], c1));
  ans = min(ans, (c1 ? 10 : 0) + solve(l, i + 1, a1, b1, c1 + l[i]));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> a >> b >> c;
  int l[n];
  for (long long i = (0); i < (n); ++i) cin >> l[i];
  cout << solve(l, 0, 0, 0, 0);
  return 0;
}
