The quiet village of Rinkaru has N jobs, and they are handed out to Rinkaru, Ad and Larry. Exactly one of the three takes each job.
Ad and Larry care about fairness, so the total pay Ad takes and the total pay Larry takes must not differ by more than D. The pay Rinkaru takes is under no condition.
Two ways of splitting the jobs are different when some job goes to a different person. Count the ways to split the jobs.
Input
The first line holds the number of jobs N. The second line holds N integers A1,…,AN, the pay of each job, separated by spaces. The third line holds D, the difference of the two totals that must not be exceeded. (1≤N≤30, 1≤Ai≤1016, 0≤D≤1018)
Output
Print the number of different ways to split the jobs.