#include <bits/stdc++.h>
#pragma G++ optimize(2)
using namespace std;
inline long long read() {
  char ch = ' ', last;
  long long ans = 0;
  while (ch < '0' || ch > '9') last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + int(ch - '0'), ch = getchar();
  if (last == '-') return -ans;
  return ans;
}
void write(long long x) {
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
long long n, need[4], src[30005], a[4], ans, dp[2 * 30005];
bool book[4], used[30005];
void init() {
  n = read();
  for (int i = 1; i <= 3; i++) a[i] = read();
  for (int i = 1; i <= n; i++) src[i] = read();
  sort(src + 1, src + n + 1);
}
int Do(int tot) {
  for (int i = 0; i <= 2000; i++)
    if (!used[i]) dp[i] = -1;
  for (int i = 1; i <= n; i++)
    if (!used[i]) dp[src[i]] = 0;
  for (int i = 1; i <= n; i++)
    if (!used[i])
      for (int j = 0; j < 2000; j++)
        if (dp[j] != -1 && j + src[i] < 2000 && j != src[i])
          if (dp[j + src[i]] == -1)
            dp[j + src[i]] = dp[j] + 10;
          else
            dp[j + src[i]] = min(dp[j + src[i]], dp[j] + 10);
  long long cnt1 = 0x3f3f3f3fLL * 0x3f3f3f3fLL, pos = 0;
  for (int i = 0; i <= 2000; i++)
    if (dp[i] != -1) {
      long long now = dp[i] + abs(tot - i);
      if (now < cnt1) cnt1 = now, pos = i;
    }
  for (int i = n; i >= 1 && pos; i--)
    if (!used[i])
      if (pos == src[i] || dp[pos - src[i]] == dp[pos] - 10)
        pos -= src[i], used[i] = true;
  for (int i = n; i >= 1 && pos; i--)
    if (!used[i])
      if (pos == src[i] || dp[pos - src[i]] == dp[pos] - 10)
        pos -= src[i], used[i] = true;
  return cnt1;
}
void dfs(int step) {
  if (step == 4) {
    memset(used, false, sizeof(used));
    long long cnt = 0;
    for (int i = 1; i <= 3; i++) {
      int kp = Do(need[i]);
      if (kp >= ans) return;
      cnt += kp;
    }
    ans = min(ans, cnt);
  } else
    for (int i = 1; i <= 3; i++)
      if (!book[i])
        need[step] = a[i], book[i] = true, dfs(step + 1), book[i] = false;
}
int main() {
  init();
  ans = 0x3f3f3f3fLL * 0x3f3f3f3fLL;
  dfs(1);
  cout << ans << endl;
  return 0;
}
