人傻了……
#include <bits/stdc++.h>
using namespace std;
long long n,a,b,c,ans;
long long x,y;
int main() {
scanf("%lld %lld %lld %lld",&n,&x,&y,&c);
b = x / 2 + y;
for(long long i = 0;i <= b;i++) {
for(long long j = 0;j <= c;j++) {
if(i + j * 2 == n) {
if(j * 2 == n) {
++ans;
continue;
}
if(max(x / 2,y) >= i) ans += min(i + 1,min(x / 2,y) + 1);
else ans += min(x / 2,y) - (i - max(x / 2,y)) + 1;
}
}
}
printf("%lld\n",ans);
return 0;
}