#include <bits/stdc++.h>
using namespace std;
int main() {
  int vs, ve, cur, sum = 0, t, d;
  cin >> vs >> ve >> t >> d;
  cur = sum = vs;
  for (int i = 2; i < t; i++) {
    cur = min(cur + d, d * (t - i) + ve);
    sum += cur;
  }
  sum += ve;
  cout << sum << endl;
}
