#include <bits/stdc++.h>
using namespace std;
int main() {
  int v1, v2, t, d, pass = 0, dis = 0, speed;
  cin >> v1 >> v2;
  cin >> t >> d;
  speed = v1;
  for (int i = 1; i < t; i++) {
    speed = min(speed + d, v2 + (t - i - 1) * d);
    dis += speed;
  }
  dis += v1;
  cout << dis << endl;
  return 0;
}
