#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
int f[200][2000];
int v1;
int v2;
int t;
int d;
int F(int time, int velo) {
  int &result = f[time][velo];
  if (result != -1) return result;
  if (time == t - 1) return velo == v2 ? velo : -INF;
  result = -INF;
  for (int x = max(0, velo - d); x <= velo + d; ++x)
    result = max(result, velo + F(time + 1, x));
  return result;
}
int main() {
  memset(f, -1, sizeof f);
  cin >> v1 >> v2 >> t >> d;
  cout << F(0, v1) << '\n';
  return 0;
}
