#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
set<int> x[3];
int p[N];
int c[N];
int t[3], k[3];
map<long long, vector<int> > out;
int main() {
  int n;
  long long ans = 0;
  for (int i = 0; i < (int)3; i++) scanf("%d ", &k[i]);
  for (int i = 0; i < (int)3; i++) scanf("%d ", &t[i]);
  scanf("%d", &n);
  for (int i = 0; i < (int)n; i++) {
    scanf("%d", &c[i]);
    out[c[i]].push_back(i);
  }
  while (out.size() != 0) {
    vector<int> mas = out.begin()->second;
    long long now = out.begin()->first;
    out.erase(out.begin());
    for (int i = 0; i < (int)mas.size(); i++) {
      if (p[mas[i]] != 3)
        x[p[mas[i]]].insert(mas[i]);
      else
        ans = max(ans, now - c[mas[i]]);
      if (p[mas[i]] != 0) k[p[mas[i]] - 1]++;
    }
    for (int i = 0; i < (int)3; i++)
      while (k[i] && x[i].size()) {
        int f = *x[i].begin();
        x[i].erase(x[i].begin());
        p[f]++;
        k[i]--;
        out[now + t[i]].push_back(f);
      }
  }
  cout << ans << endl;
  return 0;
}
