#include <bits/stdc++.h>
using namespace std;
int get_mx(int a, int b, int d, int c) {
  int mx = (b - a) + d * c;
  if (mx > d) mx = d;
  if (mx < -d) mx = -d;
  return mx;
}
int main() {
  int a, b, d, t, i, j, s = 0;
  cin >> a >> b >> t >> d;
  s = a;
  for (i = 2; i < t; i++) {
    j = get_mx(a, b, d, t - i);
    a += j;
    s += a;
  }
  s += b;
  cout << s << "\n";
  return 0;
}
