#include <bits/stdc++.h>
using namespace std;
static const int N = 100;
int r[N];
int o[N];
int main() {
  int v1, v2, t, d;
  scanf("%i", &v1);
  scanf("%i", &v2);
  scanf("%i", &t);
  scanf("%i", &d);
  r[0] = v1;
  for (int i = 1; i < t; i++) r[i] = r[i - 1] + d;
  o[t - 1] = v2;
  for (int i = t - 2; i >= 0; i--) o[i] = o[i + 1] + d;
  int sum = v1 + v2;
  int i = 1;
  while (r[i] <= o[i] && i < t - 1) {
    sum += r[i];
    i++;
  }
  while (i < t - 1) {
    sum += o[i];
    i++;
  }
  printf("%i\n", sum);
  return 0;
}
