Score : 300 points
There is a grid with H rows and W columns, where each square is painted black or white.
You are given H strings S_1, S_2, ..., S_H, each of length W.
If the square at the i-th row from the top and the j-th column from the left is painted black, the j-th character in the string S_i is #
; if that square is painted white, the j-th character in the string S_i is .
.
Find the number of pairs of a black square c_1 and a white square c_2 that satisfy the following condition:
#
and .
.Input is given from Standard Input in the following format:
H W S_1 S_2 : S_H
Print the answer.
3 3 .#. ..# #..
10
Some of the pairs satisfying the condition are ((1, 2), (3, 3)) and ((3, 1), (3, 2)), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.
2 4 .... ....
0
4 3 ### ### ... ###
6