#include <bits/stdc++.h>
using namespace std;
const int maxn = 100003;
const long long inf = 1000000000000000LL;
int n;
long long t, ans;
long long k1, k2, k3, t1, t2, t3;
long long ay[maxn];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    heap1, heap2, heap3;
queue<int> q1, q2, q3;
inline int get() {
  char ch = getchar();
  while (!isdigit(ch) && ch != -1) ch = getchar();
  int v = ch - 48;
  ch = getchar();
  while (isdigit(ch)) {
    v = v * 10 + ch - 48;
    ch = getchar();
  }
  return v;
}
void work() {
  int i = 1, j;
  long long tmp;
  t = 0;
  ans = 0;
  while (i <= n || heap1.size() > 0 || heap2.size() > 0 || heap3.size() > 0) {
    while (i <= n && ay[i] == t) {
      if (heap1.size() < k1)
        heap1.push(pair<long long, int>(ay[i] + t1, i));
      else
        q1.push(i);
      i++;
    }
    while (!heap1.empty() && heap1.top().first == t) {
      if (heap2.size() < k2)
        heap2.push(
            pair<long long, int>(heap1.top().first + t2, heap1.top().second));
      else
        q2.push(heap1.top().second);
      heap1.pop();
      if (q1.size() > 0) {
        heap1.push(pair<long long, int>(t + t1, q1.front()));
        q1.pop();
      }
    }
    while (!heap2.empty() && heap2.top().first == t) {
      if (heap3.size() < k3)
        heap3.push(
            pair<long long, int>(heap2.top().first + t3, heap2.top().second));
      else
        q3.push(heap2.top().second);
      heap2.pop();
      if (q2.size() > 0) {
        heap2.push(pair<long long, int>(t + t2, q2.front()));
        q2.pop();
      }
    }
    while (!heap3.empty() && heap3.top().first == t) {
      ans = ((ans > heap3.top().first - ay[heap3.top().second])
                 ? ans
                 : heap3.top().first - ay[heap3.top().second]);
      heap3.pop();
      if (q3.size() > 0) {
        heap3.push(pair<long long, int>(t + t3, q3.front()));
        q3.pop();
      }
    }
    tmp = inf;
    if (i <= n) tmp = ((tmp < ay[i]) ? tmp : ay[i]);
    if (!heap1.empty())
      tmp = ((tmp < heap1.top().first) ? tmp : heap1.top().first);
    if (!heap2.empty())
      tmp = ((tmp < heap2.top().first) ? tmp : heap2.top().first);
    if (!heap3.empty())
      tmp = ((tmp < heap3.top().first) ? tmp : heap3.top().first);
    if (tmp != inf) t = tmp;
  }
}
int main() {
  cin >> k1 >> k2 >> k3 >> t1 >> t2 >> t3 >> n;
  int i;
  for (i = 1; i <= n; i++) {
    ay[i] = get();
  }
  work();
  cout << ans << endl;
  return 0;
}
