#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll MOD = 1e9 + 7;
ll d[101];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  ll v1, v2, t, k, sum = 0, max;
  cin >> v1 >> v2 >> t >> k;
  if (t == 2) {
    cout << (v1 + v2);
    return 0;
  }
  d[t - 1] = v2;
  d[0] = v1;
  for (ll i = t - 2; i >= (1); --i) {
    max = v1 + i * k;
    if ((abs(max - d[i + 1])) <= k)
      d[i] = max;
    else
      d[i] = d[i + 1] + k;
    sum += d[i];
  }
  sum += d[0] + d[t - 1];
  cout << sum;
  return 0;
}
