#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int st[N], dr[N];
int main() {
  int v1, v2, t, d;
  cin >> v1 >> v2 >> t >> d;
  for (int i = 0; i < t; i++) st[i] = v1 + d * i;
  for (int i = t - 1; i >= 0; i--) dr[t - i - 1] = v2 + d * i;
  int rez = 0;
  for (int i = 0; i < t; i++) rez += min(st[i], dr[i]);
  cout << rez;
  return 0;
}
