#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, c, b, i, ans = 0, j, k;
  cin >> n >> m >> c >> b;
  int a[c + 1];
  a[1] = n;
  a[c] = m;
  for (i = 2; i < c; i++) {
    j = n + (i - 1) * b;
    k = m + (c - i) * b;
    a[i] = min(j, k);
  }
  for (i = 1; i <= c; i++) ans += a[i];
  cout << ans;
  return 0;
}
