#include <bits/stdc++.h>
using namespace std;
int m, n, l;
int v1, v2, t, d;
int main() {
  while (scanf("%d%d", &v1, &v2) == 2) {
    scanf("%d%d", &t, &d);
    int a[1000];
    int b[1000];
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    int minn = min(v1, v2);
    int maxn = max(v1, v2);
    for (int i = 1; i <= t; i++) {
      if (i == 1) {
        a[i] = minn;
        b[t] = maxn;
      } else {
        a[i] = a[i - 1] + d;
        b[t - i + 1] = b[t - i + 2] + d;
      }
    }
    int num = 0;
    for (int i = 1; i <= t; i++) num += min(a[i], b[i]);
    printf("%d\n", num);
  }
}
