#include <bits/stdc++.h>
using namespace std;
int n;
long long k[4], t[4];
long long a[4][100010], ans;
int main() {
  long long x, y;
  scanf("%I64d%I64d%I64d", &k[1], &k[2], &k[3]);
  scanf("%I64d%I64d%I64d", &t[1], &t[2], &t[3]);
  scanf("%d", &n);
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &x);
    y = x;
    for (int j = 1; j <= 3; ++j)
      x = a[j][i % k[j]] = max(a[j][i % k[j]], x) + t[j];
    ans = max(ans, x - y);
  }
  printf("%I64d\n", ans);
  return 0;
}
