#include <bits/stdc++.h>
using namespace std;
static const int INF = INT_MAX;
static const long long LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const int MOD = (10 ^ 9 + 7);
int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};
int rec(vector<int>& v, int ref, int cnt);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int ans[6] = {};
  cin >> n;
  int l[3];
  vector<int> v1, v2, v3, v4, v5, v6;
  for (int i = 0; i < 3; ++i) cin >> l[i];
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    v1.push_back(a);
    v4.push_back(a);
    v2.push_back(a);
    v5.push_back(a);
    v3.push_back(a);
    v6.push_back(a);
  }
  for (int i = 0; i < 3; ++i) {
    ans[0] += rec(v1, l[i], 0);
  }
  for (int i = 2; i >= 0; --i) {
    ans[1] += rec(v2, l[i], 0);
  }
  swap(l[0], l[1]);
  for (int i = 0; i < 3; ++i) {
    ans[2] += rec(v3, l[i], 0);
  }
  swap(l[0], l[1]);
  swap(l[1], l[2]);
  for (int i = 0; i < 3; ++i) {
    ans[3] += rec(v4, l[i], 0);
  }
  swap(l[0], l[1]);
  for (int i = 0; i < 3; ++i) {
    ans[4] += rec(v5, l[i], 0);
  }
  swap(l[0], l[1]);
  swap(l[0], l[2]);
  for (int i = 0; i < 3; ++i) {
    ans[5] += rec(v6, l[i], 0);
  }
  sort(ans, ans + 6);
  cout << *ans << endl;
  return 0;
}
int rec(vector<int>& v, int ref, int cnt) {
  int pos = INF;
  int minv = ref;
  if (ref == 0) return 10 * (cnt - 1);
  for (int i = 0; i < v.size(); ++i) {
    if (minv > abs(ref - v[i]) && v[i] != -1) {
      pos = i;
      minv = abs(ref - v[i]);
    }
  }
  if (pos != INF) {
    v[pos] = -1;
    return rec(v, minv, cnt + 1);
  } else {
    return ref + 10 * (cnt - 1);
  }
}
