#include <bits/stdc++.h>
using namespace std;
long long v[102];
long long D;
long long pathLength(long long v1, long long time, long long v2) {
  long long res = 0;
  v[0] = v1;
  v[time - 1] = v2;
  for (int(i) = (1); (i) < (time - 1); ++(i))
    v[i] = min(v[i - 1] + D, v[time - 1] + D * ((time - 1) - i));
  for (int(i) = (0); (i) < (time); ++(i)) res += v[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long v1, v2, t, d;
  cin >> v1 >> v2 >> t >> d;
  D = d;
  cout << pathLength(v1, t, v2) << endl;
  return 0;
}
