#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res % 1000000007;
}
int main() {
  int u, v;
  cin >> u >> v;
  int t, d;
  cin >> t >> d;
  int fo[t], bk[t];
  fo[0] = u;
  bk[t - 1] = v;
  for (int i = 1; i < t; i++) {
    fo[i] = fo[i - 1] + d;
  }
  for (int i = t - 2; i >= 0; i--) {
    bk[i] = bk[i + 1] + d;
  }
  int sum = 0;
  for (int i = 0; i < t; i++) {
    sum += min(fo[i], bk[i]);
  }
  cout << sum << endl;
  return 0;
}
