#include <bits/stdc++.h>
using namespace std;
static int fast_io = []() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return 0;
}();
int main() {
  int v1, v2;
  cin >> v1 >> v2;
  int t, d;
  cin >> t >> d;
  vector<int> times(t);
  times[0] = v1;
  times.back() = v2;
  for (int i = 1; i < t - 1; i++) {
    times[i] = times[i - 1] + d;
  }
  for (int i = t - 2; i >= 1; i--) {
    if (times[i] - d > times[i + 1]) {
      times[i] = times[i + 1] + d;
    }
  }
  int ans = 0;
  for (auto x : times) {
    ans += x;
  }
  cout << ans << "\n";
  return 0;
}
