#include <bits/stdc++.h>
using namespace std;
int n;
int t[3];
int inf = 5000;
int re(int cnt, int a, int b, int c, int l[n]) {
  if (cnt == n) {
    if (a != 0 && b != 0 && c != 0) {
      return abs(t[0] - a) + abs(t[1] - b) + abs(t[2] - c) - 30;
    } else {
      return inf;
    }
  }
  int A = re(cnt + 1, a, b, c, l);
  int B = re(cnt + 1, a + l[cnt], b, c, l) + 10;
  int C = re(cnt + 1, a, b + l[cnt], c, l) + 10;
  int D = re(cnt + 1, a, b, c + l[cnt], l) + 10;
  return min({A, B, C, D});
}
int main() {
  cin >> n >> t[0] >> t[1] >> t[2];
  int lm[n];
  for (int i = 0; i < n; i++) {
    cin >> lm[i];
  }
  cout << re(0, 0, 0, 0, lm);
}
