100 atcoder#ABC173C. [ABC173C] H and V

[ABC173C] H and V

Score : 300300 points

Problem Statement

We have a grid of HH rows and WW columns of squares. The color of the square at the ii-th row from the top and the jj-th column from the left (1iH,1jW)(1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character ci,jc_{i,j}: the square is white if ci,jc_{i,j} is ., and black if ci,jc_{i,j} is #.

Consider doing the following operation:

  • Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.

You are given a positive integer KK. How many choices of rows and columns result in exactly KK black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.

Constraints

  • 1H,W61 \leq H, W \leq 6
  • 1KHW1 \leq K \leq HW
  • ci,jc_{i,j} is . or #.

Input

Input is given from Standard Input in the following format:

HH WW KK

c1,1c1,2...c1,Wc_{1,1}c_{1,2}...c_{1,W}

c2,1c2,2...c2,Wc_{2,1}c_{2,2}...c_{2,W}

::

cH,1cH,2...cH,Wc_{H,1}c_{H,2}...c_{H,W}

Output

Print an integer representing the number of choices of rows and columns satisfying the condition.

2 3 2
..#
###
5

Five choices below satisfy the condition.

  • The 11-st row and 11-st column
  • The 11-st row and 22-nd column
  • The 11-st row and 33-rd column
  • The 11-st and 22-nd column
  • The 33-rd column
2 3 4
..#
###
1

One choice, which is choosing nothing, satisfies the condition.

2 2 3
##
##
0
6 6 8
..##..
.#..#.
#....#
######
#....#
#....#
208