#include <bits/stdc++.h>
using namespace std;
int main() {
  int v1 = 0, v2 = 0;
  cin >> v1 >> v2;
  int t = 0, d = 0;
  cin >> t >> d;
  int r[100];
  r[0] = v1;
  r[t - 1] = v2;
  for (int i = 1; i < t - 1; ++i) {
    r[i] = r[i - 1] + d;
  }
  for (int i = t - 2; i > 0; --i) {
    if (abs(r[i] - r[i + 1]) > d) r[i] -= abs(d - abs(r[i] - r[i + 1]));
  }
  int result = 0;
  for (int i = 0; i < t; ++i) result += r[i];
  cout << result;
  cout << endl;
  return 0;
}
