#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int i, j;
  int v1;
  cin >> v1;
  ;
  int v2;
  cin >> v2;
  ;
  int t;
  cin >> t;
  ;
  int d;
  cin >> d;
  ;
  int ans = 0;
  vector<int> arr1(t), arr2(t);
  arr1[0] = v1;
  arr2[t - 1] = v2;
  for (i = 1; i < t; i++) arr1[i] = arr1[i - 1] + d;
  for (i = t - 2; i >= 0; i--) arr2[i] = arr2[i + 1] + d;
  for (i = 0; i < t; i++) ans += min(arr1[i], arr2[i]);
  cout << ans << '\n';
}
