#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int v[N];
int main() {
  int v1, v2, t, d, k;
  while (~scanf("%d%d%d%d", &v1, &v2, &t, &d)) {
    v[0] = v1, v[t - 1] = v2;
    int le = 0, ri = t - 1, ans = 0;
    while (le < ri - 1) {
      if (v[le] < v[ri])
        v[le + 1] = v[le++] + d;
      else
        v[ri - 1] = v[ri--] + d;
    }
    for (int i = 0; i < t; ++i) ans += v[i];
    printf("%d\n", ans);
  }
  return 0;
}
