#include <bits/stdc++.h>
using namespace std;
int v1, v2, t, dd;
int d[110][10100];
int a[110][10100];
int main() {
  cin >> v1 >> v2;
  cin >> t >> dd;
  int ans;
  d[1][v1] = v1;
  for (int i = 2; i <= t; i++) {
    for (int j = 1; j <= 10000; j++)
      if (d[i - 1][j] > 0) {
        for (int k = 0; k <= dd; k++)
          d[i][j + k] = max(d[i - 1][j] + (j + k), d[i][j + k]);
      }
  }
  a[t][v2] = v2;
  if (d[t][v2] > 0) ans = d[t][v2] + a[t][v2] - v2;
  for (int i = t - 1; i >= 1; i--) {
    for (int j = 1; j <= 10000; j++)
      if (a[i + 1][j] > 0)
        for (int k = 0; k <= dd; k++) {
          a[i][j + k] = a[i + 1][j] + (j + k);
          if (d[i][j + k] > 0)
            ans = max(ans, d[i][j + k] + a[i][j + k] - (j + k));
        }
  }
  if (a[1][v1] > 0) ans = max(ans, a[1][v1] + d[1][v1] - v1);
  cout << ans;
  return 0;
}
