#include <bits/stdc++.h>
using namespace std;
const int kk = 1000000;
int F[105][3000] = {0};
int main() {
  int v1, v2, t, d;
  cin >> v1 >> v2 >> t >> d;
  memset(F, -10000, sizeof F);
  F[1][v1] = 0;
  for (int i = 2; i <= t; i++)
    for (int j = 0; j <= v1 + (t + 1) * d; j++) {
      int m = F[i - 1][j + d] + j + d;
      for (int k = max(0, j - d); k <= j + d; k++) m = max(m, F[i - 1][k] + k);
      F[i][j] = m;
    }
  cout << F[t][v2] + v2;
  return 0;
}
