100 atcoder#ABC173C. [ABC173C] H and V
[ABC173C] H and V
Score : points
Problem Statement
We have a grid of rows and columns of squares. The color of the square at the -th row from the top and the -th column from the left is given to you as a character : the square is white if is .
, and black if 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 . How many choices of rows and columns result in exactly 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
- is
.
or#
.
Input
Input is given from Standard Input in the following format:
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 -st row and -st column
- The -st row and -nd column
- The -st row and -rd column
- The -st and -nd column
- The -rd column
2 3 4
..#
###
1
One choice, which is choosing nothing, satisfies the condition.
2 2 3
##
##
0
6 6 8
..##..
.#..#.
#....#
######
#....#
#....#
208