#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int l[n];
  for (int i = 0; i < n; ++i) cin >> l[i];
  sort(l, l + n);
  if (a <= l[0]) {
    cout << l[0] + l[1] + l[2] - (a + b + c) << endl;
    return 0;
  }
  cout << "あとわからん" << endl;
  return 0;
}
