#include <bits/stdc++.h>
using namespace std;
int main() {
  int v1, v2, t, d;
  scanf("%d %d %d %d", &v1, &v2, &t, &d);
  int ara1[t + 1], ara2[t + 1];
  ara1[0] = v1;
  ara2[t - 1] = v2;
  for (int i = 1; i < t; i++) {
    ara1[i] = ara1[i - 1] + d;
  }
  for (int i = t - 2; i >= 0; i--) {
    ara2[i] = ara2[i + 1] + d;
  }
  int sum = 0;
  for (int i = 0; i < t; i++) {
    sum += min(ara1[i], ara2[i]);
  }
  cout << sum << endl;
  return 0;
}
