Chocolate bar
Roma is playing an intriguing solo game with a box of chocolates arranged in a grid of n×m pieces. The chocolates are either dark or white. Initially, the box is filled randomly with these chocolates. Roma's task is to repeatedly perform the following operation: he looks for three adjacent chocolates of the same color, either in a straight line or forming an "L" shape, eats them, and then refills the empty spaces with new chocolates placed randomly. The game concludes when no such group of three adjacent chocolates can be found.
Your task is to determine how many distinct configurations can remain on the board once the game ends. For instance, if n = 2 and m = 3, there are eight possible final configurations:
(In these configurations, "B" represents dark chocolate and "W" represents white chocolate.)
Input
The input consists of two integers, n and m (1 ≤ n, m ≤ 1000).
Output
Output a single integer, which is the number of distinct configurations that can remain on the board when the game ends.