#include <bits/stdc++.h>
using namespace std;
int dp(int result, vector<int> a, vector<int> t) {
  sort(a.begin(), a.end());
  sort(t.begin(), t.end());
  for (int j = 0; j < a.size() + 1; j++) {
    for (int i = 0; i < t.size() + 1; i++) {
      if (abs(t[i] - a[j]) < 10) {
        result += abs(t[i] - a[j]);
        a.erase(a.begin() + j);
        t.erase(t.begin() + i);
      }
    }
  }
  if (a.empty()) return result;
  cout << a[0] << endl;
  cout << result << endl;
  int m = 100000000000;
  for (int i = 0; i < t.size(); i++) {
    for (int j = 0; j < t.size(); j++) {
      vector<int> k = t;
      k[i] += k[j];
      k.erase(k.begin() + j);
      m = min(dp(result + 10, a, k), m);
    }
  }
  return m;
}
int main() {
  int n, a, b, c;
  vector<int> v;
  cin >> n >> a >> b >> c;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  vector<int> t;
  int result = 0;
  int dum;
  for (int i = 0; i < n; i++) {
    cin >> dum;
    t.push_back(dum);
  }
  cout << dp(result, v, t) << endl;
  return 0;
}
