Problem: Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the rows of the rectangle from top to bottom with numbers from 1 to n, and the columns — from left to right with numbers from 1 to m. Let's denote the cell at the intersection of the r-th row and the c-th column as (r, c).

Initially the pig stands in cell (1, 1), and in the end she wants to be in cell (n, m). Since the pig is in a hurry to get home, she can go from cell (r, c), only to either cell (r + 1, c) or (r, c + 1). She cannot leave the forest.

The forest, where the pig is, is very unusual. Some cells of the forest similar to each other, and some look very different. Peppa enjoys taking pictures and at every step she takes a picture of the cell where she is now. The path through the forest is considered to be beautiful if photographs taken on her way, can be viewed in both forward and in reverse order, showing the same sequence of photos. More formally, the line formed by the cells in order of visiting should be a palindrome (you can read a formal definition of a palindrome in the previous problem).

Count the number of beautiful paths from cell (1, 1) to cell (n, m). Since this number can be very large, determine the remainder after dividing it by 109 + 7.

Input

The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the height and width of the field.

Each of the following n lines contains m lowercase English letters identifying the types of cells of the forest. Identical cells are represented by identical letters, different cells are represented by different letters.

Output

Print a single integer — the number of beautiful paths modulo 109 + 7.

Examples

Input

3 4
aaab
baaa
abba


Output

3

Note

Picture illustrating possibilities for the sample test. 

<image>

<image>

<image>

Solution (in JAVA):

Solution:
import java.util.Arrays;
import java.util.Scanner;

public class TaskE {

	public static Scanner in = new Scanner(System.in);
    public static final int MODUL = 1000000007;

    public static int low(int i, int j, int n, int m) {
//        if (m - 1 - (i + j) >= 0) return n - 1;
//        return n - 1 + (m - 1 - (i + j));
        return n - 1 - (i + j <= n - 1 ? i + j : n - 1);
    }

    public static int high(int i, int j, int n, int m) {
//        if (i + j >= n - 1) return 0;
//        return
        return n - 1 - (i + j <= m - 1 ? 0 : i + j - m + 1);
    }

	public static void main(String[] args) {
	    int n = in.nextInt();
        int m = in.nextInt();
        in.nextLine();

        String[] lines = new String[n];
        for (int i = 0; i < n; i++) {
            lines[i] = in.nextLine();
        }

        int i = 0;
        int result = 0;
        int[][] prev = null;
        int[][] curr = null;
        while (i < n) {
            prev = curr;
            curr = new int[m][];
            for (int j = 0; j < m; j++) {
                //int height = Math.min(i + j + 1, n - i + m - j - 1);
                int low = low(i, j, n, m);
                int high = high(i, j, n, m);
                curr[j] = new int[n];
                Arrays.fill(curr[j], 0);
                if (i == 0 && j == 0) {
                    curr[j][n - 1] = (lines[0].charAt(0) == lines[n - 1].charAt(m - 1) ? 1 : 0);
                    continue;
                }
                for (int h = low; h <= high; h++) {
                    curr[j][h] = 0;
                    if (lines[i].charAt(j) == lines[h].charAt(m - 1 - (i + j) + (n - 1 - h))) {
                        if (j > 0)
                            curr[j][h] = (curr[j][h] + curr[j - 1][h]) % MODUL;
                        if (j > 0 && h < n - 1)
                            curr[j][h] = (curr[j][h] + curr[j - 1][h + 1]) % MODUL;
                        if (i > 0)
                            curr[j][h] = (curr[j][h] + prev[j][h]) % MODUL;
                        if (i > 0 && h < n - 1)
                            curr[j][h] = (curr[j][h] + prev[j][h + 1]) % MODUL;
                    }
                }
                if (i + j == (n + m) / 2 - 1) {
                    result = (result + curr[j][i]) % MODUL;
                    if (i < n - 1 && (n + m) % 2 != 0) result = (result + curr[j][i + 1]) % MODUL;
                }
            }
//            for (int h = 0; h < n; h++) {
//                for (int j = 0; j < m; j++) {
//                    System.out.print(curr[j][h] + " ");
//                }
//                System.out.println();
//            }
//            System.out.println();
            i++;
        }

        System.out.println(result);
    }

}