#include <bits/stdc++.h>
using namespace std;
template <class T>
T mulmod(T a, T b) {
  if (b == 0) return 0;
  if (b == 1) return a;
  T x = mulmod(a, b >> 1);
  x = (x + x) % 1000000007;
  if (b & 1) x = (x + a) % 1000000007;
  return x;
}
template <class T>
T larger(T a, T b) {
  return (a > b ? a : b);
}
template <class T>
T smaller(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <class T>
string converter(T n) {
  stringstream x;
  x << n;
  return x.str();
}
template <class T>
T pw(T a, T b) {
  if (b == 0) return 1;
  T x = pw(a, b >> 1);
  x = (x * x) % 1000000007;
  if (b & 1) x = (x * a) % 1000000007;
  return x;
}
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
void letsgo() {
  int v1, v2, t, d;
  cin >> v1 >> v2 >> t >> d;
  int ans = 0;
  int x = v1, y = v2 + d * (t - 1);
  for (int i = 0; i < t; i++) {
    ans += min(x, y);
    x += d, y -= d;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  letsgo();
  return 0;
}
