#include <bits/stdc++.h>
using namespace std;
int v[101], vrev[101], vans[101];
int main() {
  ios::sync_with_stdio(false);
  int v1, v2;
  cin >> v1 >> v2;
  int t, d;
  cin >> t >> d;
  v[1] = v1;
  for (int i = 2; i <= t; i++) v[i] = v[i - 1] + d;
  vrev[t] = v2;
  for (int i = t - 1; i >= 1; i--) vrev[i] = vrev[i + 1] + d;
  int s = 0;
  for (int i = 1; i <= t; i++) {
    vans[i] = min(v[i], vrev[i]);
    s += vans[i];
  }
  cout << s << endl;
  return 0;
}
