#include <bits/stdc++.h>
using namespace std;
int v1, v2, t, d, cnt = 0;
int T[100 + 8][10000 + 8];
set<pair<int, int> > Q;
int main() {
  cin >> v1 >> v2 >> t >> d;
  Q.insert(make_pair(0, v1));
  T[0][v1] = v1;
  while (!Q.empty()) {
    set<pair<int, int> >::iterator it = Q.begin();
    pair<int, int> tmp = *it;
    Q.erase(it);
    if (tmp.first == t - 1) continue;
    for (int i = 0; i <= d; i++) {
      T[tmp.first + 1][tmp.second + i] =
          max(T[tmp.first + 1][tmp.second + i],
              T[tmp.first][tmp.second] + tmp.second + i);
      Q.insert(make_pair(tmp.first + 1, tmp.second + i));
      if (tmp.second - i < 0) continue;
      T[tmp.first + 1][tmp.second - i] =
          max(T[tmp.first + 1][tmp.second - i],
              T[tmp.first][tmp.second] + tmp.second - i);
      Q.insert(make_pair(tmp.first + 1, tmp.second - i));
    }
  }
  cout << T[t - 1][v2] << endl;
  return 0;
}
