String Path

No attempts yetTime limit1sMemory limit128 MB

Problem

There is a rectangular grid of size N×MN \times M. Every cell holds one uppercase letter. Rows are numbered 1 to NN from top to bottom, and columns are numbered 1 to MM from left to right.

Consider a route that starts at (1,1)(1, 1), moves one cell down or one cell right at each step, and ends at (N,M)(N, M). Writing every letter of the visited cells in the order they are visited gives a string of length N+M1N+M-1, and that string is called a string path of the grid. Different routes can give several string paths in one grid.

You are given two different strings of length N+M1N+M-1. Write a program that counts the rectangular grids for which both strings are string paths. Two grids count as different when some position holds a different letter. The count can be large, so print it modulo 1,000,000,009.

Input

The first line contains two natural numbers NN and MM. (1N,M81 \le N, M \le 8)

The second line and the third line each contain one string of uppercase letters of length N+M1N+M-1. The two strings are different.

Output

Print the number of rectangular grids for which both given strings are string paths, modulo 1,000,000,009.

Hint

With N=2N = 2, M=2M = 2 and the strings ABC and ADC, the two grids below satisfy the condition.

AB
DC
AD
BC