#include <bits/stdc++.h>
using namespace std;
const int l = 100 + 10;
int ars[l];
int art[l];
int main() {
  int n, m, t, d, sum = 0;
  cin >> n >> m >> t >> d;
  ars[1] = n;
  ars[t] = m;
  for (int i = t - 1; i > 1; i--) {
    ars[i] = ars[i + 1] + d;
  }
  art[1] = n;
  sum = n;
  for (int i = 2; i <= t; i++) {
    art[i] = min(ars[i], art[i - 1] + d);
    sum += art[i];
  }
  cout << sum;
  return 0;
}
