func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAX = (long long)1e6 + 100;   long long inf = (long long)1e18;   long long mod = (long long)1e9 + 7;   long long n, a, b, c, d;   long long get_maxi() {     long long uk1 = 0, uk2 = c + 1;     while (uk2 - uk1 > 1) {       long long mid = (uk2 + uk1) / 2;       if (mid * b < a)         uk1 = mid;       else         uk2 = mid;     }     return uk1;   }   void solve() {     cin >> a >> b >> c >> d;     if (c * b < a) {       cout << -1 <<   n ;       return;     }     long long act = get_maxi();     act -= act % d;     c = act;     long long am = (c / d + 1) * a - (c * (c / d + 1) / 2) * b;     cout << am <<   n ;   }   int main() {     mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());     long long q;     ios::sync_with_stdio(0);     cin >> q;     while (q--) solve();     return 0;   }   