#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int ans = 0, i, j, t, u, v, n, c, s, a, b, d;
  cin >> u >> v >> t >> d;
  c = v + d * (t - 1);
  while (t--) {
    ans += min(c, u);
    u += d;
    c -= d;
  }
  cout << ans;
}
