#include <bits/stdc++.h>
using namespace std;
int x, y, x_, y_, i = 2, j;
int arr[109], sm;
bool b, bb;
int main() {
  cin >> x >> y >> x_ >> y_;
  arr[1] = x;
  arr[x_] = y;
  for (int q = 2; q < x_; q++) {
    arr[q] = arr[q - 1] + y_;
  }
  for (int q = 1; q < x_; q++) {
    for (int i = 2; i < x_; i++) {
      if (arr[i] - arr[i - 1] > y_)
        while (arr[i] - arr[i - 1] > y_) arr[i]--;
      if (arr[i] - arr[i + 1] > y_)
        while (arr[i] - arr[i + 1] > y_) arr[i]--;
    }
  }
  for (int i = 1; i <= x_; i++) sm += arr[i];
  cout << sm;
  return 0;
}
