Coins are arranged on a table in a rectangular grid of H rows and W columns.
Initially, for the coin in row i from the top (1 ≦ i ≦ H) and column j from the left (1 ≦ j ≦ W),
the heads side is visible if Si,j= #, and the tails side is visible if Si,j= ..
Aoi and Rin decide to play a game using these coins. The game proceeds as follows.
Both Aoi and Rin want to collect as many coins as possible.
Given the initial state of the coins, write a program that determines the number of coins each player can collect when both play optimally.
# or . (1 ≦ i ≦ H, 1 ≦ j ≦ W).
The input is given in the following format.
H W
S1,1 S1,2 … S1,W
S2,1 S2,2 … S2,W
︙
SH,1 SH,2 … SH,W
Output the scores of Aoi and Rin in this order, separated by a space.
1 1 #
1 0
In this sample input, the game always proceeds as follows.
The visible side of the only coin changes from "heads → tails → heads", so Aoi can collect 1 coin, while Rin cannot collect any coins. Therefore, output 1 and 0 in this order, separated by a space.
5 5 ##### ####. ###.. ##... #....
13 12
An example of the game progression when both players play optimally is shown in the figure below.
1 40 ..........##########..........##########
19 21
7 1 # # # # # # #
1 6
5 5 .###. ...## ..##. .##.. ##...
11 14
10 40 ........................................ ..######.....####.....#####.....####.... .....#......#....#......#......#........ .....#......#....#......#......#........ .....#......#....#......#......#........ .....#......#....#......#......#..####.. ..#..#......#....#......#......#....#... ..#..#......#....#......#......#....#... ...##........####.....#####.....####.... ........................................
104 296
Japan Olympiad in Informatics Committee "3rd Japan Olympiad in Informatics Girls Division Finals Problem"