func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int t;     cin >> t;     while (t--) {       long long p, f, s, w, cntS, cntW;       cin >> p >> f >> cntS >> cntW >> s >> w;       if (s > w) {         swap(cntS, cntW);         swap(s, w);       }       long long ans = 0;       for (long long i = 0; i <= cntS; i++) {         if (i * s > p) break;         long long sf = i;         long long ss = min(f / s, cntS - i);         long long leftf = p - sf * s;         long long lefts = f - ss * s;         long long wf = min(cntW, leftf / w);         long long ws = min(cntW - wf, lefts / w);         ans = max(ans, ss + sf + wf + ws);       }       cout << ans << endl;     }     return 0;   }   