#include <bits/stdc++.h>
using namespace std;
int n;
int A, B, C;
vector<int> l(10);
int ans = 10000;
int abs(int x) {
  if (x < 0) return -x;
}
void dfs(int count, int a, int b, int c, int m) {
  if (count == n) {
    if (a != 0 && b != 0 && c != 0) {
      ans = min(m + abs(a - A) + abs(b - B) + abs(c - C) - 30, ans);
    }
    return;
  }
  dfs(count + 1, a, b, c, m);
  dfs(count + 1, a + l.at(count), b, c, m + 10);
  dfs(count + 1, a, b + l.at(count), c, m + 10);
  dfs(count + 1, a, b, c + l.at(count), m + 10);
}
int main() {
  cin >> n;
  cin >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> l.at(i);
  }
  dfs(0, 0, 0, 0, 0);
  cout << ans << endl;
}
