#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 1000 * 1000;
int k[3], t[3];
int n;
long long c[1 << 17], out[1 << 17], q[1 << 17];
;
int main() {
  for (int i = 0; i < 3; ++i) cin >> k[i];
  for (int i = 0; i < 3; ++i) cin >> t[i];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    out[i] = c[i];
  }
  for (int i = 0; i < 3; ++i) {
    memset(q, 0, sizeof(q));
    int cur = 0;
    for (int j = 0; j < n; ++j) {
      out[j] = max(q[cur], out[j]);
      out[j] += t[i];
      q[cur++] = out[j];
      cur %= k[i];
    }
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) res = max(res, out[i] - c[i]);
  cout << res;
  return 0;
}
