#include <bits/stdc++.h>   using namespace std;   int main(void) {     cin.sync_with_stdio(false);     long long k[3];     int t[3];     int n, i, j;     for (i = 0; i < 3; i++) cin >> k[i];     for (i = 0; i < 3; i++) cin >> t[i];     cin >> n;     vector<long long> a(n);     vector<long long> b(n);     for (i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     for (j = 0; j < 3; j++)       if (k[j] > n) k[j] = n;     for (j = 0; j < 3; j++) {       priority_queue<long long, vector<long long>, greater<long long> > Q;       for (i = 0; i < k[j]; i++) {         Q.push(0);       }       for (i = 0; i < n; i++) {         long long p = Q.top();         Q.pop();         if (p < b[i]) p = b[i];         b[i] = p + t[j];         Q.push(b[i]);       }     }     long long ans = 0;     for (i = 0; i < n; i++) {       if (b[i] - a[i] > ans) ans = b[i] - a[i];     }     cout << ans << endl;     return 0;   }   