AIM Tech Round 4 (Div. 2)
B
Rectangles
Codeforces
1300
原题
← AC →
翻译中…

You are given $*n* × *m*$ table. Each cell of the table is colored white or black. Find the number of non-empty sets of cells such that:

翻译中…
  1. All cells in a set have the same color.
  2. Every two cells in a set share row or column.
翻译中…

Input

翻译中…

The first line of input contains integers $*n*$ and $*m*$ ($1 ≤ *n*, *m* ≤ 50$) — the number of rows and the number of columns correspondingly.

翻译中…

The next $*n*$ lines of input contain descriptions of rows. There are $*m*$ integers, separated by spaces, in each line. The number equals $0$ if the corresponding cell is colored white and equals $1$ if the corresponding cell is colored black.

翻译中…

Output

翻译中…

Output single integer  — the number of non-empty sets from the problem description.

翻译中…

Note

翻译中…

In the second example, there are six one-element sets. Additionally, there are two two-element sets, the first one consists of the first and the third cells of the first row, the second one consists of the first and the third cells of the second row. To sum up, there are $8$ sets.

翻译中…

样例

Input #1
1 1
0
Output #1
1
InputCopy OutputCopy
Input #2
2 3
1 0 1
0 1 0
Output #2
8
InputCopy OutputCopy
题目信息
题号
844B
时间限制
1 s
内存限制
256 MB
标签
组合数学
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。