#include <bits/stdc++.h>
using namespace std;
inline int nxt() {
  int x;
  cin >> x;
  return x;
}
template <class T>
inline void LOG(T s) {}
const int INF = (int)1e9;
const int MODULO = (int)1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  int vs, ve, t, d;
  cin >> vs >> ve >> t >> d;
  vector<vector<int> > dp(t, vector<int>(10000, -1));
  function<int(int, int)> solve = [&](int second, int speed) {
    if (second == t - 1) {
      if (speed == ve) {
        return ve;
      } else {
        return -1000000;
      }
    }
    if (dp[second][speed] != -1) return dp[second][speed];
    int mx = -1000000;
    for (int i = max(speed - d, 0); i <= speed + d; i++) {
      mx = max(mx, solve(second + 1, i) + speed);
    }
    return dp[second][speed] = mx;
  };
  cout << solve(0, vs) << '\n';
  return 0;
}
