#include <bits/stdc++.h>
using namespace std;
const int INF = 100000;
int N, A, B, C;
vector<int> mem;
int solve() {
  int bit[3];
  int total = 1 << N;
  int Min = INF;
  for (bit[0] = 1; bit[0] < total; bit[0]++)
    for (bit[1] = 1; bit[1] < total; bit[1]++) {
      if (bit[0] & bit[1]) continue;
      for (bit[2] = 1; bit[2] < total; bit[2]++) {
        if (bit[0] & bit[2] || bit[1] & bit[2]) continue;
        int cnt = 0;
        int a = 0, b = 0, c = 0;
        for (int num = 0; num < N; num++) {
          if (bit[0] & (1 << num)) {
            a += mem[num];
            cnt += 10;
          } else if (bit[1] & (1 << num)) {
            b += mem[num];
            cnt += 10;
          } else if (bit[2] & (1 << num)) {
            c += mem[num];
            cnt += 10;
          }
          int res = abs(a - A) + abs(b - B) + abs(c - C) + cnt - 30;
          if (res >= 0) Min = min(res, Min);
        }
      }
    }
  return Min;
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int v;
    cin >> v;
    mem.push_back(v);
  }
  printf("%d\n", solve());
}
