Tic-tac-toe#1800

Tic-tac-toe

1 second
64 megabytes
Very easy

Peter and Vasylko are playing a game on a paper sheet of size M \times N. The players take turns placing either a cross or a nought into empty cells, until all cells are filled.

Peter's score is computed as follows: select any cell containing a cross, choose a direction (up, down, left, right, or either diagonal), and count how many consecutive cells containing crosses can be passed through in that direction (including the starting and ending cells of the segment). The maximal such number is Peter's score. Similarly, Vasylko's score is determined in the same way, but with noughts.

Write a program to determine the final scores of the game.

Input

The first line contains two integers and (1 \leq M, N \leq 1000), the size of the sheet. Each of the next lines contains integers, each equal to either or ( indicates a nought in the cell, indicates a cross).

Output

Print a single line containing the score of the game: two integers, the first being Peter's score, and the second being Vasylko's score.

Examples

Example 3

Loading
Loading