#include <bits/stdc++.h>
using namespace std;
int a[110];
int b[110];
int main() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int v1, v2, t, d;
  cin >> v1 >> v2 >> t >> d;
  a[1] = v1;
  for (int i = 2; i <= t; i++) a[i] = a[i - 1] + d;
  b[t] = v2;
  for (int i = t - 1; i >= 1; i--) b[i] = b[i + 1] + d;
  int ans = 0;
  for (int i = 1; i <= t; i++) ans += min(a[i], b[i]);
  cout << ans << endl;
  return 0;
}
