#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long> > tq;
long long K[3];
long long T[3];
long long n;
queue<pair<long long, long long> > q[3], inp, waitQueue[3];
int main(void) {
  for (long long i = 0; i < 3; i++) scanf("%I64d", K + i);
  for (long long i = 0; i < 3; i++) scanf("%I64d", T + i);
  scanf("%I64d", &n);
  for (long long i = 0; i < n; i++) {
    long long data;
    scanf("%I64d", &data);
    tq.push(data);
    inp.push(make_pair(data, data));
  }
  long long ans = 0;
  while (!tq.empty()) {
    long long curTime = tq.top();
    while (!tq.empty() && tq.top() == curTime) tq.pop();
    while (!inp.empty() && inp.front().first == curTime) {
      waitQueue[0].push(inp.front());
      inp.pop();
    }
    while (!q[0].empty() && q[0].front().first == curTime) {
      waitQueue[1].push(q[0].front());
      q[0].pop();
    }
    while (!q[1].empty() && q[1].front().first == curTime) {
      waitQueue[2].push(q[1].front());
      q[1].pop();
    }
    while (!q[2].empty() && q[2].front().first == curTime) {
      pair<long long, long long> fin = q[2].front();
      ans = max(ans, fin.first - fin.second);
      q[2].pop();
    }
    long long canIn = waitQueue[0].size();
    canIn = min(canIn, K[0] - (long long)q[0].size());
    for (long long i = 0; i < canIn; i++) {
      pair<long long, long long> tar = waitQueue[0].front();
      waitQueue[0].pop();
      tar.first = curTime + T[0];
      q[0].push(tar);
    }
    if (canIn) tq.push(curTime + T[0]);
    canIn = waitQueue[1].size();
    canIn = min(canIn, K[1] - (long long)q[1].size());
    for (long long i = 0; i < canIn; i++) {
      pair<long long, long long> tar = waitQueue[1].front();
      waitQueue[1].pop();
      tar.first = curTime + T[1];
      q[1].push(tar);
    }
    if (canIn) tq.push(curTime + T[1]);
    canIn = waitQueue[2].size();
    canIn = min(canIn, K[2] - (long long)q[2].size());
    for (long long i = 0; i < canIn; i++) {
      pair<long long, long long> tar = waitQueue[2].front();
      waitQueue[2].pop();
      tar.first = curTime + T[2];
      q[2].push(tar);
    }
    if (canIn) tq.push(curTime + T[2]);
  }
  printf("%I64d\n", ans);
  return 0;
}
