#include <bits/stdc++.h>
using namespace std;
int main() {
  int v1, v2, t, d;
  int sum = 0;
  scanf("%d%d%d%d", &v1, &v2, &t, &d);
  while (t--) {
    sum += v1;
    if (v1 + d <= v2 + (t - 1) * d) {
      v1 += d;
      continue;
    } else {
      v1 = v2 + (t - 1) * d;
      continue;
    }
  }
  printf("%d\n", sum);
  return 0;
}
