#include <bits/stdc++.h>
using namespace std;
int n;
int A, B, C;
vector<int> l;
int dfs(int cnt, int a, int b, int c) {
  if (cnt == n) {
    return (a * b * c == 0 ? 1e9 : abs(a - A) + abs(b - B) + abs(c - C) - 30);
  }
  int tmp0 = dfs(cnt + 1, a, b, c);
  int tmp1 = dfs(cnt + 1, a + l[cnt], b, c) + 10;
  int tmp2 = dfs(cnt + 1, a, b + l[cnt], c) + 10;
  int tmp3 = dfs(cnt + 1, a, b, c + l[cnt]) + 10;
  return min(tmp0, min(tmp1, min(tmp2, tmp3)));
}
int main() {
  cin >> n >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  for (int i = 0; i < (int)(n); i++) cout << l[i] << endl;
  int ans = dfs(0, 0, 0, 0);
  cout << ans << endl;
}
