func_code_string: #include <bits/stdc++.h>   using namespace std;   int K[3];   long long T[3];   queue<long long> waiting[3];   queue<pair<long long, long long> > events[3];   long long res = 0;   void ServeSomeone(long long t) {     for (int i = 0; i < 3; i++)       if (K[i] && !waiting[i].empty()) {         K[i]--;         events[i].push(make_pair(waiting[i].front(), t + T[i]));         waiting[i].pop();       }   }   void ProcessEvents(long long max_time) {     while (true) {       int mini = -1;       for (int i = 0; i < 3; i++)         if (!events[i].empty() && (mini == -1 || events[i].front().second <                                                      events[mini].front().second))           mini = i;       if (mini == -1) break;       if (events[mini].front().second > max_time) break;       pair<long long, long long> m = events[mini].front();       events[mini].pop();       K[mini]++;       if (mini == 2) {         res = max(res, m.second - m.first);       } else {         waiting[mini + 1].push(m.first);       }       ServeSomeone(m.second);     }   }   int main() {     cin >> K[0] >> K[1] >> K[2];     cin >> T[0] >> T[1] >> T[2];     int N;     cin >> N;     for (int i = 0; i < N; i++) {       long long next_arrival;       cin >> next_arrival;       ProcessEvents(next_arrival);       waiting[0].push(next_arrival);       ServeSomeone(next_arrival);     }     ProcessEvents(1000000000000000000LL);     cout << res << endl;   }   