func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int MOD = 1000000007;   void solve() {     int p, f;     cin >> p >> f;     if (f > p) swap(p, f);     int cs, cw;     cin >> cs >> cw;     int s, w;     cin >> s >> w;     if (w > s) {       swap(w, s);       swap(cs, cw);     }     int maxv = 0;     for (int x = 0; x <= min(cw, f / w); x++) {       int curr = x;       int fr = f - x * w;       int pr = p;       int csr = cs;       int cwr = cw - x;       int t = min(csr, fr / s);       curr += t;       csr -= t;       curr += min(cwr, pr / w);       pr -= min(cwr, pr / w) * w;       curr += min(csr, pr / s);       maxv = max(maxv, curr);     }     cout << maxv << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int tt = 1;     cin >> tt;     for (int ttt = 1; ttt <= tt; ttt++) {       solve();     }     return 0;   }   