#include <bits/stdc++.h>
using namespace std;
struct Q {
  long long timeact, arrived, type;
  Q(long long a = 0, long long b = 0, long long c = 0)
      : timeact(a), arrived(b), type(c) {}
  bool operator<(const Q& x) const {
    if (timeact == x.timeact) {
      if (type == x.type) return arrived < x.arrived;
      return type > x.type;
    }
    return timeact < x.timeact;
  }
};
multiset<Q> events;
long long disp[5];
multiset<long long> people[5];
long long ans;
long long tact, t[4];
void adjust(Q x) {
  disp[x.type]++;
  if (x.type == 3) {
    ans = max(ans, x.timeact - x.arrived + 1);
    return;
  }
  people[x.type + 1].insert(x.arrived);
}
void mk_sett() {
  for (long long i(1); i <= 3; i++) {
    if (disp[i] && !people[i].empty()) {
      disp[i]--;
      events.insert((Q){tact + t[i], *people[i].begin(), i});
      people[i].erase(people[i].begin());
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> disp[1] >> disp[2] >> disp[3] >> t[1] >> t[2] >> t[3] >> n;
  while (n--) {
    long long x;
    cin >> x;
    events.insert((Q){x, x, 0});
  }
  while (!events.empty()) {
    tact = events.begin()->timeact;
    adjust(*events.begin());
    events.erase(events.begin());
    mk_sett();
  }
  cout << ans - 1ll;
  return 0;
}
