Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Young
Time Limit: 1000MSMemory Limit: 30000K
Total Submissions: 444Accepted: 135

Description

Consider m natural numbers n1, n2, ..., nm with the property n1 >= n2 >= ... >= nm > 0.

We define a Young table as an arrangement in a table of n1 + n2 + ... + nm natural numbers (bigger than 0 and any two different), so that the ith line has ni elements (1 <= i <= m) in ascending order from left to right, and the elements from the same column are in ascending order from bottom to top.

An example of Young table for m = 4, n1 = 6, n2 = 4, n3 = 4, n4 = 1 is the following:
1	2	5	9	10	15

3 6 7 13
4 8 12 14
11

Given n1, n2, ..., nm determine the number of Young tables containing the elements 1, 2, ..., n1+n2+...+nm.

Input

The input has the stucture:

on the first line is: the natural number m (1 <= m <= 20);
on the second line are: the numbers n1, n2, ..., nm separated by a space (n1 <= 12).

Output

The output will contain the number of Young tables that can be built.

Sample Input

2
3 2

Sample Output

5

Hint

The five Young tables are:

1

3

5

1

2

3

1

2

4

2

4

4

5

3

5

1

3

4

1

2

5

2

5

3

4

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator