#include <bits/stdc++.h>
int dp[10001][105];
int lim;
int difference;
int final_speed;
int path(int speed, int time) {
  if (time == lim && speed == final_speed) return speed;
  if (time == lim) return -1000000000;
  if (dp[speed][time] != -1) return dp[speed][time];
  dp[speed][time] = -1000000000;
  for (int i = -difference; i <= difference; i++)
    if (speed + i >= 0)
      dp[speed][time] =
          std::max(dp[speed][time], speed + path(speed + i, time + 1));
  return dp[speed][time];
}
int main() {
  int initial;
  scanf("%d %d", &initial, &final_speed);
  scanf("%d %d", &lim, &difference);
  memset(dp, -1, sizeof(dp));
  int ans = path(initial, 1);
  printf("%d\n", ans);
}
