#include <bits/stdc++.h>
using namespace std;
int N;
long long a[100010], b[100010];
queue<long long> in, out;
void func(int cap, long long T) {
  int i;
  for ((i) = 0; (i) < (int)(N); (i)++) in.push(b[i]);
  int next = 0;
  while (!in.empty()) {
    long long t = in.front();
    while (out.size() == cap) {
      long long t2 = out.front();
      b[next] = t2;
      next++;
      t = max(t, t2);
      out.pop();
    }
    in.pop();
    out.push(t + T);
  }
  while (!out.empty()) {
    long long t = out.front();
    b[next] = t;
    next++;
    out.pop();
  }
}
int main(void) {
  int k1, k2, k3, t1, t2, t3, c, i;
  cin >> k1 >> k2 >> k3 >> t1 >> t2 >> t3 >> N;
  for ((i) = 0; (i) < (int)(N); (i)++) {
    scanf("%d", &c);
    a[i] = c;
  }
  sort(a, a + N);
  for ((i) = 0; (i) < (int)(N); (i)++) b[i] = a[i];
  func(k1, t1);
  func(k2, t2);
  func(k3, t3);
  long long ans = 0;
  for ((i) = 0; (i) < (int)(N); (i)++) ans = max(ans, b[i] - a[i]);
  cout << ans << endl;
  return 0;
}
