#include <bits/stdc++.h>
using namespace std;
long long t[5], k[5], c[100005], l, mx, n;
map<long long, long long> dp[5];
int main() {
  for (int i = 1; i <= 3; i++) {
    cin >> k[i];
  }
  for (int i = 1; i <= 3; i++) {
    cin >> t[i];
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    l = c[i];
    for (int j = 1; j <= 3; j++) {
      dp[j][(i - 1) % k[j]] = max(l, dp[j][(i - 1) % k[j]]) + t[j];
      l = dp[j][(i - 1) % k[j]];
    }
    mx = max(mx, l - c[i]);
  }
  cout << mx << endl;
}
