#include <bits/stdc++.h>
using namespace std;
ifstream Cin("input.txt");
ofstream Cout("output.txt");
int main() {
  long long i, k[3], t[3], tt[100001][3], n, an = 0, c, tmp;
  for (i = 0; i < 3; i++) cin >> k[i];
  for (i = 0; i < 3; i++) cin >> t[i];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> c;
    tmp = c;
    if (i - k[0] >= 0) c = max(c, tt[i - k[0]][0]);
    c += t[0];
    tt[i][0] = c;
    if (i - k[1] >= 0) c = max(c, tt[i - k[1]][1]);
    c += t[1];
    tt[i][1] = c;
    if (i - k[2] >= 0) c = max(c, tt[i - k[2]][2]);
    c += t[2];
    tt[i][2] = c;
    an = max(an, c - tmp);
  }
  cout << an;
}
