JOI emblem

No attempts yetTime limit1sMemory limit256 MB

Problem

The Japan committee for the Olympiad in Informatics is preparing a new JOI flag. The flag is an MM by NN grid of squares, and each square shows J, O, or I.

The committee also fixed a JOI emblem: a 22 by 22 grid of squares with J, O, or I in each cell.

An emblem occurrence in the flag is a 22 by 22 region whose four letters match the emblem exactly without rotation or reflection. Overlapping regions are counted separately.

The committee has the old flag and one blank sticker that can cover a single square. The sticker can show any of J, O, or I. Exactly one of these actions is allowed:

Keep the old flag unchanged and do not use the sticker.

Write one letter on the sticker, place it on one square of the old flag, and use the resulting grid as the new flag.

Find the maximum possible number of emblem occurrences in the new flag.

Input

The first line contains MM and NN. The next MM lines are strings of length NN over J, O, and I describing the old flag. Row ii, column jj is the jj-th character on the ii-th of these lines.

The following two lines are strings of length 22 over J, O, and I describing the emblem.

Output

Print one integer: the maximum number of emblem occurrences in the new flag.

Constraints

2M10002 \le M \le 1000

2N10002 \le N \le 1000