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.
[samples]
## 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.
你被给定一个 #cf_span[n × m] 的表格。表格中的每个单元格被染成白色或黑色。求满足以下条件的非空单元格集合的数量:
输入的第一行包含整数 #cf_span[n] 和 #cf_span[m](#cf_span[1 ≤ n, m ≤ 50]),分别表示行数和列数。
接下来的 #cf_span[n] 行包含各行的描述。每行有 #cf_span[m] 个用空格分隔的整数,若对应单元格为白色则该数为 #cf_span[0],若为黑色则为 #cf_span[1]。
请输出一个整数 —— 题目描述中非空集合的数量。
在第二个例子中,有六个单元素集合。此外,还有两个双元素集合:第一个由第一行的第一和第三个单元格组成,第二个由第二行的第一和第三个单元格组成。总计有 #cf_span[8] 个集合。
## Input
输入的第一行包含整数 #cf_span[n] 和 #cf_span[m](#cf_span[1 ≤ n, m ≤ 50]),分别表示行数和列数。接下来的 #cf_span[n] 行包含各行的描述。每行有 #cf_span[m] 个用空格分隔的整数,若对应单元格为白色则该数为 #cf_span[0],若为黑色则为 #cf_span[1]。
## Output
请输出一个整数 —— 题目描述中非空集合的数量。
[samples]
## Note
在第二个例子中,有六个单元素集合。此外,还有两个双元素集合:第一个由第一行的第一和第三个单元格组成,第二个由第二行的第一和第三个单元格组成。总计有 #cf_span[8] 个集合。
**Definitions**
Let $ n, m \in \mathbb{Z}^+ $ with $ 1 \leq n, m \leq 50 $.
Let $ A \in \{0,1\}^{n \times m} $ be a binary matrix representing the table, where $ A_{i,j} = 0 $ denotes a white cell and $ A_{i,j} = 1 $ denotes a black cell.
Let $ \mathcal{C} = \{ (i,j) \mid 1 \leq i \leq n,\, 1 \leq j \leq m \} $ be the set of all cell positions.
**Constraints**
Each cell $ (i,j) \in \mathcal{C} $ has color $ A_{i,j} \in \{0,1\} $.
**Objective**
Count the number of non-empty subsets $ S \subseteq \mathcal{C} $ such that:
- For every row $ i \in \{1, \dots, n\} $, the set $ S \cap \{ (i,1), (i,2), \dots, (i,m) \} $ is either empty or contains **only black cells** and forms a **contiguous segment** (i.e., if two cells in row $ i $ are in $ S $, then all cells between them in that row are also in $ S $).
- For every column $ j \in \{1, \dots, m\} $, the set $ S \cap \{ (1,j), (2,j), \dots, (n,j) \} $ is either empty or contains **only black cells** and forms a **contiguous segment**.
Equivalently:
A non-empty subset $ S \subseteq \mathcal{C} $ is valid if and only if:
1. $ \forall (i,j) \in S $, $ A_{i,j} = 1 $,
2. In every row $ i $, the columns $ j $ for which $ (i,j) \in S $ form a contiguous interval (possibly empty),
3. In every column $ j $, the rows $ i $ for which $ (i,j) \in S $ form a contiguous interval (possibly empty).
Compute $ \left| \left\{ S \subseteq \mathcal{C} \mid S \neq \emptyset \text{ and } S \text{ satisfies conditions 1–3} \right\} \right| $.