Under construction

Still being built. Things may change

Letters Q and F

Time limit2sMemory limit512 MB

Summary
Given a final n by m grid where non-overlapping Q and F shapes were painted, count how many of each letter Lev drew.
Level

Easy3 of 10

Topics
Implementation, Matrix
Solved
No attempts yet

Statement

Little Lev is learning how to draw the letters Q and F. At first, the grid is a white grid of size n×mn \times m. Then Lev draws several letters, each in one of the two shapes below.

Lev does not rotate or mirror these shapes. Each time he draws a letter, he picks a position in the grid and paints all cells of the shape black. He only draws a letter where every cell of the shape is still white, so no cell is ever painted twice.

Given the final coloring of the grid, count the letters Q and the letters F that Lev drew.

Input

The first line contains two integers nn and mm, the height and the width of the grid (5≤n≤3005 \le n \le 300; 3≤m≤3003 \le m \le 300). The next nn lines each contain mm characters describing the final state of the grid. A white cell is '.' and a black cell is '\#'.

The grid is guaranteed to be a valid result of Lev's drawing.

Output

Print two integers: the number of letters Q and the number of letters F, in that order.

Hint

The figure below shows the fourth test case.

Examples4

  1. Example 1

    Input
    5 3
    ###
    #.#
    ###
    ..#
    ..#
    
    Expected output
    1 0
    
  2. Example 2

    Input
    5 3
    ###
    #..
    ##.
    #..
    #..
    
    Expected output
    0 1
    
  3. Example 3

    Input
    5 8
    ###..###
    #.#..#..
    ###..##.
    ..#..#..
    ..#..#..
    
    Expected output
    1 1
    
  4. Example 4

    Input
    8 8
    .....###
    ###..#.#
    #.######
    ###.####
    #.###.##
    #.#.###.
    ..#...#.
    ......#.
    
    Expected output
    2 2