func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5;   const int M = 1e7 + 1;   const long long INF = 1LL << 61;   long long a[N], t[N], cost[N];   inline long long bs(long long bytes, long long maxt) {     long long res = -1;     if (t[0] <= t[2]) {       if ((t[0] * bytes) <= maxt) {         res = 0;       }       return res;     }     if (bytes <= 0) {       return 0;     }     int l = 0;     int r = M;     while (l <= r) {       int mid = l + (r - l) / 2;       long long b_left = bytes - mid * a[2];       long long t_left = maxt - mid * a[2] * t[2];       if (b_left < 0) {         if (llabs(b_left) < a[2]) {           t_left += (b_left * (-t[2]));           b_left = 0;         } else {           r = mid - 1;           continue;         }       }       t_left -= (b_left * t[0]);       if (t_left >= 0) {         res = mid;         r = mid - 1;       } else {         l = mid + 1;       }     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     long long size, maxt;     cin >> size >> maxt;     cin >> t[0];     for (int i = int(1); i < int(3); i++) {       cin >> a[i] >> t[i] >> cost[i];     }     if (t[2] < t[1]) {       swap(a[1], a[2]);       swap(t[1], t[2]);       swap(cost[1], cost[2]);     }     long long ans = INF;     for (int i = int(0); i < int(M); i++) {       long long money = i * cost[1];       long long bytes = size - i * a[1];       long long tt = maxt - (i * a[1] * t[1]);       if (bytes > 0) {         long long use2 = bs(bytes, tt);         money += (use2 * cost[2]);         if (use2 >= 0) {           ans = min(ans, money);         }       } else if (bytes < 0) {         tt += (bytes * (-t[1]));       }       if (bytes <= 0 and tt >= 0) {         ans = min(ans, money);       }     }     if (ans >= INF) {       ans = -1;     }     cout << ans <<   n ;     return 0;   }   