Vasya has taken the post of court alchemist, and his task is to brew the philosopher's stone by mixing ingredients.
There are K ingredients. An experiment is a plan (a1,a2,…,aK): Vasya takes ai ounces of the i-th ingredient, pours everything into the crucible, and heats it. Every ai is a non-negative integer, and the total amount may not exceed the crucible capacity S, so a1+a2+⋯+aK≤S. In every experiment at least two ingredients are actually used: at least two of the ai are strictly positive.
So far every mixture has exploded. Vasya has spotted a monotonicity rule: if a plan (a1,…,aK) explodes, then every plan (b1,…,bK) with bi≥ai for all i explodes as well.
Vasya has already carried out M experiments, and all of them exploded. Call a plan definitely unsuccessful when the monotonicity rule guarantees it will explode, i.e. when at least one of the M exploded plans (c1,…,cK) satisfies ai≥ci for every i.
Count how many valid experiment plans are not definitely unsuccessful. A plan is valid when every ai is a non-negative integer, a1+⋯+aK≤S, and at least two of the ai are positive.
The first line contains three integers K, S, and M (2≤K≤30, 2≤S≤10000, 0≤M≤20), where M is the number of experiments already conducted. Each of the next M lines contains K integers describing one already-conducted experiment (all of which exploded).
Print one integer: the number of valid experiment plans that are not definitely unsuccessful. This count can be very large, so print the exact value.