CF44B.Cola

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

To celebrate the opening of the Winter Computer School the organizers decided to buy in nn liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.50.5 , 11 and 22 liters in volume. At that, there are exactly aa bottles 0.50.5 in volume, bb one-liter bottles and cc of two-liter ones. The organizers have enough money to buy any amount of cola. What did cause the heated arguments was how many bottles of every kind to buy, as this question is pivotal for the distribution of cola among the participants (and organizers as well).

Thus, while the organizers are having the argument, discussing different variants of buying cola, the Winter School can't start. Your task is to count the number of all the possible ways to buy exactly nn liters of cola and persuade the organizers that this number is too large, and if they keep on arguing, then the Winter Computer School will have to be organized in summer.

All the bottles of cola are considered indistinguishable, i.e. two variants of buying are different from each other only if they differ in the number of bottles of at least one kind.

输入格式

The first line contains four integers — nn , aa , bb , cc ( 1<=n<=100001<=n<=10000 , 0<=a,b,c<=50000<=a,b,c<=5000 ).

输出格式

Print the unique number — the solution to the problem. If it is impossible to buy exactly nn liters of cola, print 00 .

输入输出样例

  • 输入#1

    10 5 5 5
    

    输出#1

    9
    
  • 输入#2

    3 0 0 2
    

    输出#2

    0
    
首页