#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcount(s);
}
template <class T>
inline T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long v1, v2, t, d, dp[101][1102], lu[101][2102];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> v1 >> v2 >> t >> d;
  dp[1][v1] = v1;
  for (long long i = 2, _b = t; i <= _b; i++) {
    for (long long j = 0, _b = 1100; j <= _b; j++) {
      for (long long k = 0, _b = d; k <= _b; k++) {
        if (j > k && dp[i][j] < dp[i - 1][j - k] + j && dp[i - 1][j - k] > 0) {
          dp[i][j] = dp[i - 1][j - k] + j;
          lu[i][j] = -k;
        }
        if (j + k <= 1100 && dp[i][j] < dp[i - 1][j + k] + j &&
            dp[i - 1][j + k] > 0) {
          dp[i][j] = dp[i - 1][j + k] + j;
          lu[i][j] = k;
        }
      }
    }
  }
  cout << dp[t][v2];
  return 0;
}
