#include <bits/stdc++.h>
using namespace std;
int main() {
  int v1, v2;
  scanf("%d%d", &v1, &v2);
  if (v1 > v2) {
    swap(v1, v2);
  }
  int t, d;
  scanf("%d%d", &t, &d);
  int dist = 0, speed = v1;
  for (int i = 1; i <= t; ++i) {
    dist += speed;
    if (i < t) speed = min((t - i - 1) * d + v2, speed + d);
  }
  printf("%d", dist);
}
