#include <bits/stdc++.h>
using namespace std;
int t, v1, v2, d;
long long memo[101][50000];
long long solve(int i, int curr) {
  if (i == t && curr == v2) return v1;
  if (i == t) return -2147483647;
  long long &ret = memo[i][curr];
  if (ret != -1) return ret;
  long long maxdist = -2147483647;
  for (int j = 0; j < int(d + 1); ++j)
    maxdist = max(maxdist, max(solve(i + 1, curr + j) + curr + j,
                               solve(i + 1, curr - j) + curr - j));
  return ret = maxdist;
}
int main() {
  memset(memo, -1, sizeof(memo));
  cin >> v1 >> v2 >> t >> d;
  cout << solve(1, v1) << endl;
}
