A nearby meadow is divided into square fields arranged in n rows and m columns. The rows are numbered 1 to n from top to bottom, and the columns are numbered 1 to m from left to right. Some fields are grass (marked "1"), and some are underwater because of the heavy spring rain (marked "0").
Two grass fields are connected if you can get from one to the other by a series of moves, where each move goes to an adjacent grass field up, down, left, or right. A component is a maximal set of mutually connected grass fields: if a field A is in the component K, then every grass field adjacent to A is also in K.
For a meadow P and indices a and b (1≤a≤b≤n), Pab is the meadow made of rows a through b of the original meadow P (both row a and row b included). The complexity of the meadow Pab is the number of components of grass fields in it. Find the sum of the complexities of all possible meadows Pab.