#include <bits/stdc++.h>
using namespace std;
int abs(int a) {
  if (a < 0) a = -a;
  return a;
}
int make(vector<int> bms, int S) {
  int simple_count = abs(S - bms[0]);
  for (int i = 0; i < bms.size(); i++) {
    int ab = abs(S - bms[i]);
    if (ab < simple_count) simple_count = ab;
  }
  int connect = simple_count;
  for (int i = 0; i < bms.size(); i++) {
    if (bms[i] > S) {
      break;
    } else {
      for (int j = i + 1; j < bms.size(); i++) {
        int next = bms[i] + bms[j];
        if (abs(next - S) + 10 > simple_count) {
          break;
        } else {
          bms.erase(bms.begin() + j);
          bms.erase(bms.begin() + i);
          bms.push_back(next);
          connect = 10 + make(bms, S);
        }
      }
    }
  }
  return min(simple_count, connect);
}
int main() {
  int n, A, B, C;
  cin >> n >> A >> B >> C;
  vector<int> bamboos(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    bamboos.push_back(a);
  }
  int min_len = 100000000;
  for (int bit = 0; bit < (1 << n); bit++) {
    int sum = 0;
    int count = 0;
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        sum += bamboos[i];
        count++;
      }
    }
    if (count < 3) {
      break;
    } else {
      sum += 10 * (count - 3);
    }
    if (sum < min_len) {
      min_len = sum;
    }
  }
  cout << min_len << endl;
  return 0;
}
