#include <bits/stdc++.h>
using namespace std;
int n, k[10], t[10], timp[1000005];
deque<pair<long long, int>> Q[10];
deque<int> A[10];
int main() {
  int i, j, x;
  long long minn, sol = -(1LL << 62);
  cin.sync_with_stdio(0);
  for (i = 2; i <= 4; ++i) cin >> k[i];
  for (i = 2; i <= 4; ++i) cin >> t[i];
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> x;
    timp[i] = x;
    Q[1].push_back(make_pair(x, i));
  }
  while (1) {
    minn = (1LL << 62);
    for (i = 1; i <= 4; ++i)
      if (!Q[i].empty() && Q[i].front().first < minn) minn = Q[i].front().first;
    if (minn == (1LL << 62)) break;
    for (i = 4; i; --i) {
      while (!Q[i].empty() && Q[i].front().first == minn) {
        sol = max(sol, minn - timp[Q[i].front().second]);
        int om = Q[i].front().second;
        Q[i].pop_front();
        if (i == 4) continue;
        if ((int)Q[i + 1].size() < k[i + 1])
          Q[i + 1].push_back(make_pair(minn + t[i + 1], om));
        else
          A[i + 1].push_back(om);
      }
      for (; (int)A[i].size() && k[i] - (int)Q[i].size();) {
        Q[i].push_back(make_pair(minn + t[i], A[i].front()));
        A[i].pop_front();
      }
    }
  }
  cout << sol << "\n";
  return 0;
}
