#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int N = 0;
int a[5], m;
long long sum(int len, int x) {
  return 1LL * len * x - 1LL * (x + 1) * x / 2 + x;
}
long long cal(int x, int y, int bar, int len) {
  if (len < 0) return 0;
  int R = min(bar - y, len), L = min(len - (bar - x), R);
  long long ans = 0;
  if (L >= 0)
    ans += 1LL * (L + 1) * (bar - x + 1);
  else
    L = -1;
  ans += sum(len, R) - sum(len, L);
  return ans;
}
long long solve(int x, int y, int z, int len) {
  int tmp = max(max(y, z) + 1, x);
  len -= tmp - x;
  x = tmp;
  long long ans = 0;
  for (auto i = 0; i <= len; i++) {
    int cur = x + i, rem = min(2 * (cur - 1) - y - z, len - i);
    if (rem > cur - y - z)
      ans += cal(y, z, cur - 1, rem) - cal(y, z, cur - 1, (cur - y - z));
  }
  return ans;
}
long long solve2(int x, int y, int z, int len) {
  int tmp = max(x, y);
  len -= 2 * tmp - x - y;
  x = tmp;
  if (x <= z) len -= 2 * (z + 1 - x), x = z + 1;
  long long ans = 0;
  if (len >= 0)
    for (auto i = 0; i <= len / 2; i++) {
      int rem = len - 2 * i;
      ans += min(x + i - 1 - z, rem) + 1;
    }
  return ans;
}
int main() {
  for (auto i = 0; i <= 2; i++) cin >> a[i];
  cin >> m;
  long long ans = 0;
  for (auto i = 0; i <= 2; i++)
    ans += solve(a[i], a[(i + 1) % 3], a[(i + 2) % 3], m);
  for (auto i = 0; i <= 2; i++)
    ans += solve2(a[i], a[(i + 1) % 3], a[(i + 2) % 3], m);
  int tmp = *max_element(a, a + 3), v = 0;
  for (auto i = 0; i <= 2; i++) v += tmp - a[i];
  if (v <= m) ans += (m - v) / 3 + 1;
  cout << ans;
}
