COEF  Coeficientes
The problem is to calculate the coefficients in expansion of polynomial (x_{1}+x_{2}+...+x_{k})^{n}.
Input
The input will consist of a set of pairs of lines. The first line of the pair consists of two integers n and k separated with space (0 < n, k <13). This integers define the power of the polynomial and the amount of the variables. The second line in each pair consists of k nonnegative integers n_{1}, ..., n_{k}, where n_{1}+...+n_{k}=n.
Output
For each input pair of lines the output line should consist one integer, the coefficient by the monomial x_{1}^{n1}x_{2}^{n2}...x_{k}^{nk} in expansion of the polynomial (x_{1}+x_{2}+...+x_{k})^{n}.
Example
Input: 2 2 1 1 2 12 1 0 0 0 0 0 0 0 0 0 1 0 Output: 2 2
hide comments
vineetpratik:
20160622 07:35:42
multinomial coefficient and proper EOF.


azam_9:
20160528 19:54:34
just take care input format..i.e EOF to terminate the input in C...rest piece of cake. Last edit: 20160528 19:54:48 

raghav12345:
20151101 09:12:38
my 50th!!!


aishik_pyne:
20150919 08:51:12
what are the number of inputs?


Mayank Garg:
20150404 11:26:59
my 50th !!


ashish kumar:
20150116 15:53:31
my 90th 

#include:
20150110 13:38:45
my 100th on spoj 

Sahil Dua:
20141108 06:47:07
Simple one. Keep trying, until you get AC in 0.00 

jinkies:
20141015 12:51:18
very easy, just terminate input properly 

Jackson:
20141010 07:16:42
Easy one...... Read Multinomial coefficients in Multinomial theorem.. 
Added by:  Coach UTN FRSF 
Date:  20100602 
Time limit:  0.333s1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  http://uva.onlinejudge.org/external/101/10105.html 