#include <bits/stdc++.h>
using namespace std;
struct person {
  long long came;
  long long time_entered_queue;
  long long nr;
  person() {}
  person(long long a, long long b, long long c)
      : came(a), time_entered_queue(b), nr(c) {}
};
const int N = 100010;
int n;
long long k[6];
long long t[6];
long long came[N];
queue<person> zb[7];
queue<person> wait[7];
const long long inf = 1000000000000000000LL;
;
int main() {
  for (int i = 0; i < (3); ++i) cin >> k[2 * i + 1];
  for (int i = 0; i < (3); ++i) cin >> t[2 * i + 1];
  t[0] = t[2] = t[4] = 0;
  k[0] = k[2] = k[4] = k[6] = N;
  cin >> n;
  long long cur_time = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> came[i];
    zb[0].push(person(came[i], came[i], i));
  }
  int zost = n;
  long long maksTime = 0;
  long long czek;
  while (zost) {
    czek = inf;
    for (int i = 0; i < (6); ++i)
      if (!zb[i].empty()) {
        if (zb[i + 1].size() < k[i + 1])
          czek = min(
              czek,
              max(((zb[i].front()).time_entered_queue + t[i] - cur_time), 1LL));
      }
    cur_time += czek;
    for (int i = 5; i >= 1; i -= 2) {
      if (i < 5) {
        while (!zb[i].empty() &&
               ((zb[i].front()).time_entered_queue + t[i]) <= cur_time &&
               zb[i + 1].size() < k[i + 1]) {
          person temp = zb[i].front();
          zb[i].pop();
          zb[i + 1].push(person(temp.came, cur_time, temp.nr));
        }
      } else {
        while (!zb[i].empty() &&
               ((zb[i].front()).time_entered_queue + t[i] <= cur_time)) {
          maksTime = max(maksTime, cur_time - (zb[i].front()).came);
          zost--;
          zb[i].pop();
        }
      }
    }
    for (int i = 4; i >= 0; i -= 2) {
      while (!zb[i].empty() &&
             ((zb[i].front()).time_entered_queue + t[i]) <= cur_time &&
             zb[i + 1].size() < k[i + 1]) {
        person temp = zb[i].front();
        zb[i].pop();
        zb[i + 1].push(person(temp.came, cur_time, temp.nr));
      }
    }
  }
  cout << maksTime << endl;
}
