Codeforces Round 317 [AimFund Thanks-Round] (Div. 1)
A
Lengthening Sticks
Codeforces
2100
原题
←B →
翻译中…

You are given three sticks with positive integer lengths of $*a*, *b*$, and $*c*$ centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at most $*l*$ centimeters. In particular, it is allowed not to increase the length of any stick.

翻译中…

Determine the number of ways to increase the lengths of some sticks so that you can form from them a non-degenerate (that is, having a positive area) triangle. Two ways are considered different, if the length of some stick is increased by different number of centimeters in them.

翻译中…

Input

翻译中…

The single line contains $4$ integers $*a*, *b*, *c*, *l*$ ($1 ≤ *a*, *b*, *c* ≤ 3·10^{5}$, $0 ≤ *l* ≤ 3·10^{5}$).

翻译中…

Output

翻译中…

Print a single integer — the number of ways to increase the sizes of the sticks by the total of at most $*l*$ centimeters, so that you can make a non-degenerate triangle from it.

翻译中…

Note

翻译中…

In the first sample test you can either not increase any stick or increase any two sticks by $1$ centimeter.

翻译中…

In the second sample test you can increase either the first or the second stick by one centimeter. Note that the triangle made from the initial sticks is degenerate and thus, doesn't meet the conditions.

翻译中…

样例

Input #1
1 1 1 2
Output #1
4
InputCopy OutputCopy
Input #2
1 2 3 1
Output #2
2
InputCopy OutputCopy
Input #3
10 2 1 7
Output #3
0
InputCopy OutputCopy
题目信息
题号
571A
时间限制
1 s
内存限制
256 MB
标签
组合数学
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。