#include <bits/stdc++.h>
using namespace std;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
int mem[109][2018];
int n, d, add = 1000, v1, v2;
int solve(int idx, int cur) {
  if (idx == n) {
    if (cur == v2) return v2;
    return -1e6;
  }
  int& ret = mem[idx][cur + add];
  if (ret != -1) return ret;
  ret = -1e6;
  for (int i = 0; i <= d; i++) {
    ret = max(ret, cur + solve(idx + 1, cur + i));
    ret = max(ret, cur + solve(idx + 1, cur - i));
  }
  return ret;
}
int main() {
  file();
  fast();
  memset(mem, -1, sizeof mem);
  cin >> v1 >> v2 >> n >> d;
  cout << solve(1, v1) << "\n";
  return 0;
}
