1638 座位安排


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

Elly and some of her friends (possibly none) are going to the movies. Their company consists of N people, including Elly. Since they don't want to be spread across the entire hall, they decided to sit either in the same row or in the same column (though not necessarily next to one another).

Your are given a matrix M consisting of char representing the layout of seats in the theater that are already taken. The M[i][j] will be '#' if the seat at row i, column j is already taken and '.' if it is empty.

calculate the number of different ways for Elly and her friends to choose N different empty seats so that their seating requirement is fulfilled. Two ways are considered different if there exists a person in their company that will sit in different seats in these two ways.

Input

Multi testcase. For every case ,there will be three integer N,R,C(1<=N<=8,1<=R,C<=50)represent the number of people and rows, columns of the char matrix. Then a R*C char matrix.

Output

The number of different ways

Sample

Input

3 2 3
#..
...
2 3 3
..#
.##
...

Output

6
16

Comments

There are no comments at the moment.