#include <bits/stdc++.h>
int main() {
  int v1, v2, t, d, i, j;
  scanf("%d%d%d%d", &v1, &v2, &t, &d);
  int ans = v1 + v2;
  int curr = v1;
  int rem = t - 1;
  for (i = 0; i < t - 2; i++) {
    rem--;
    for (j = d; j >= -d; j--) {
      int temp = curr + j;
      if (temp >= v2 && temp - v2 <= (d * rem)) {
        ans += temp;
        curr = temp;
        break;
      } else if (v2 >= temp && v2 - temp <= (d * rem)) {
        ans += temp;
        curr = temp;
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
