#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
enum { WAITING_A, FINISHED_A, WAITING_B, FINISHED_B, WAITING_C, FINISHED_C };
struct STATE {
  long long eventTime;
  int state;
  int index;
  STATE(long long eventTime, int state, int index)
      : eventTime(eventTime), state(state), index(index) {}
  bool operator<(const STATE& rh) const { return eventTime > rh.eventTime; }
};
int main() {
  std::ios::sync_with_stdio(false);
  int k1, k2, k3;
  long long t1, t2, t3;
  cin >> k1 >> k2 >> k3 >> t1 >> t2 >> t3;
  priority_queue<STATE> q;
  vector<long long> cs;
  int N;
  cin >> N;
  for (int n = 0; n < (int)N; ++n) {
    long long c;
    cin >> c;
    q.push(STATE(c, WAITING_A, n));
    cs.push_back(c);
  }
  long long answer = -1;
  int rest1 = k1;
  int rest2 = k2;
  int rest3 = k3;
  queue<int> waiting1;
  queue<int> waiting2;
  queue<int> waiting3;
  while (!q.empty()) {
    const STATE state = q.top();
    q.pop();
    switch (state.state) {
      case WAITING_A: {
        if (rest1 == 0) {
          waiting1.push(state.index);
        } else {
          --rest1;
          q.push(STATE(state.eventTime + t1, FINISHED_A, state.index));
        }
        break;
      }
      case FINISHED_A: {
        q.push(STATE(state.eventTime, WAITING_B, state.index));
        ++rest1;
        if (!waiting1.empty()) {
          const int index = waiting1.front();
          waiting1.pop();
          --rest1;
          q.push(STATE(state.eventTime + t1, FINISHED_A, index));
        }
        break;
      }
      case WAITING_B: {
        if (rest2 == 0) {
          waiting2.push(state.index);
        } else {
          --rest2;
          q.push(STATE(state.eventTime + t2, FINISHED_B, state.index));
        }
        break;
      }
      case FINISHED_B: {
        q.push(STATE(state.eventTime, WAITING_C, state.index));
        ++rest2;
        if (!waiting2.empty()) {
          const int index = waiting2.front();
          waiting2.pop();
          --rest2;
          q.push(STATE(state.eventTime + t2, FINISHED_B, index));
        }
        break;
      }
      case WAITING_C: {
        if (rest3 == 0) {
          waiting3.push(state.index);
        } else {
          --rest3;
          q.push(STATE(state.eventTime + t3, FINISHED_C, state.index));
        }
        break;
      }
      case FINISHED_C: {
        answer = ((answer) > (state.eventTime - cs[state.index])
                      ? (answer)
                      : (state.eventTime - cs[state.index]));
        ++rest3;
        if (!waiting3.empty()) {
          const int index = waiting3.front();
          waiting3.pop();
          --rest3;
          q.push(STATE(state.eventTime + t3, FINISHED_C, index));
        }
        break;
      }
    }
  }
  cout << answer << endl;
}
