func_code_string: #include <bits/stdc++.h>   using namespace ::std;   int main() {     long long int temp, q, v1, v2, t, d, i, sum = 0;     cin >> v1 >> v2 >> t >> d;     long long int a[t];     sum = d * (t - 1);     i = 0;     temp = 0;     bool ff = false;     while (1) {       if (!ff) {         i += v1;         a[temp] = i;         temp++;         ff = true;         continue;       } else if (i + d - sum + d <= v2) {         i += d;         sum -= d;         a[temp] = i;       } else {         for (long long int k = d - 1; k >= -d; k--) {           if (i + k - sum + d <= v2) {             i += k;             sum -= d;             a[temp] = i;             break;           }         }       }       temp++;       if (temp == t) break;     }     long long int s = 0;     for (long long int j = 0; j < t; j++) s += a[j];     cout << s;   }   