func_code_string: #include <bits/stdc++.h>   using namespace std;   bool cmp(int a, int b) {     if (a > b)       return true;     else       return false;   }   struct pack {     long long t, T, x, cost;   };   int main() {     long long ans = 0, n, m;     cin >> n >> m;     vector<pack> data;     for (int i = 0; i < (n); ++i) {       pack temp;       cin >> temp.t >> temp.T >> temp.x >> temp.cost;       data.push_back(temp);     }     for (int i = 0; i < (n); ++i) {       data[i].T = data[i].T - data[i].t;       if (data[i].T > 0) {         long long ans1;         if (m > data[i].T)           ans1 = data[i].cost + m * data[i].x;         else           ans1 = data[i].cost;         if (m > data[i].T) {           long long k = data[i].cost * ((m + data[i].T - 1) / data[i].T);           ans1 = min(ans1, k);         }         if (m > 2 * data[i].T) {           long long ans2 = m % data[i].T + data[i].T;           ans1 = min(ans1, data[i].cost * (1 + (m - ans2) / data[i].T) +                                ans2 * data[i].x);         }         ans += ans1;       } else {         ans += data[i].cost + m * data[i].x;       }     }     cout << ans << endl;   }   