#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int main() {
  int v1, v2;
  scanf("%d%d", &v1, &v2);
  int t, d;
  scanf("%d%d", &t, &d);
  vector<int> a(t, 0x3f3f3f3f);
  for (int(i) = 0; (i) < (int)(t); ++(i)) amin(a[i], v1 + d * i);
  for (int(i) = 0; (i) < (int)(t); ++(i)) amin(a[i], v2 + d * (t - 1 - i));
  long long ans = accumulate((a).begin(), (a).end(), 0LL);
  cout << ans << endl;
  return 0;
}
