#ALCATRAZ4. THE SHORTEST PATH

THE SHORTEST PATH

You are given a 2D grid with each cell containing a letter, you have to start at any point and move either up, down, left and right to create the word "ALCATRAZ" by picking up letters in order. After choosing a letter, it gets removed and leaves the cell empty. You have to determine the minimum number of moves needed to do so.

Input

2 space separated integers N, M (number of rows and columns respectively.)

1 ≤ N, M ≤ 500

Then next N lines gives the details of the maze.

Output

The shortest path as described in the above problem.

Print "IMPOSSIBLE" (without quotes) if you can't make that word.

Example

Input:
4 5
AZCLT
AARAL
SJATC
LARAZ

Output: 9

</p>

Path is as follows: 2, 4 → 2, 5 → 3, 5 → 3, 4 → 3, 3 → 3, 4 → 4, 4 → 4, 3 → 4, 4 → 4, 5