#include <bits/stdc++.h>
using namespace std;
int dist(vector<int> v, int a, int b, int c) {
  vector<vector<int>> my_dist(v.size());
  for (int i = 0; i < v.size(); i++) {
    my_dist[i].push_back(abs(v[i] - a));
    my_dist[i].push_back(abs(v[i] - b));
    my_dist[i].push_back(abs(v[i] - c));
  }
  return *min_element(my_dist[0].begin(), my_dist[0].end()) +
         *min_element(my_dist[1].begin(), my_dist[1].end()) +
         *min_element(my_dist[2].begin(), my_dist[2].end());
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  int Mp = 0;
  for (int i = 0; i < l.size() - 1; i++) {
    cout << "test" << i << endl;
    if (l[i] < A) {
      for (int j = i + 1; j < l.size(); j++) {
        vector<int> l2;
        copy(l.begin(), l.end(), back_inserter(l2));
        l2[i] = l2[i] + l2[j];
        l2.erase(l2.begin() + j);
        if (dist(l, A, B, C) - dist(l2, A, B, C) > 10) {
          copy(l2.begin(), l2.end(), back_inserter(l));
          Mp += 10;
        }
      }
    }
    cout << Mp + dist(l, A, B, C) << endl;
  }
}
