func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve() {     long long a, b, c, d;     cin >> a >> b >> c >> d;     if (a > b * c) {       cout <<  -1 n ;       return;     }     if (c < d) {       cout << a <<   n ;       return;     }     long long mx = c / d;     long long k = (2 * a - b * d) / (2 * d * b);     long long ans = 0;     for (long long i = k - 1; i <= k + 1; i++) {       if (i < 0 || i > mx) continue;       ans = max(ans, (i + 1) * a - i * (i + 1) / 2 * b * d);     }     cout << ans <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout << fixed;     cout.precision(30);     long long t = 1;     cin >> t;     while (t--) solve();   }   