#include <bits/stdc++.h>
using namespace std;
std::vector<int> maxspeed;
std::vector<int> speed;
int main() {
  int v1;
  int v2;
  cin >> v1 >> v2;
  int d;
  int t;
  int i;
  cin >> t >> d;
  maxspeed.resize(t);
  speed.resize(t);
  maxspeed[t - 1] = v2;
  maxspeed[0] = v1;
  speed[t - 1] = v2;
  speed[0] = v1;
  int metros = 0;
  for (i = t - 2; i >= 0; i--) {
    maxspeed[i] = maxspeed[i + 1] + d;
  }
  for (i = 1; i < t; i++) {
    speed[i] = min(maxspeed[i], speed[i - 1] + d);
    metros += speed[i - 1];
  }
  metros += speed[t - 1];
  cout << metros << endl;
}
