#include <bits/stdc++.h>
using namespace std;
int main() {
  float v1, v2, t, d, s = 0;
  cin >> v1 >> v2;
  cin >> t >> d;
  t = t - 2;
  s += v1 + v2;
  while (t > 0) {
    if ((v1 + d - v2) / t <= d)
      s += v1 + d, v1 += d;
    else
      v1 = v2 + d * t, s += v2 + d * t;
    t--;
  }
  cout << s << endl;
}
