You are at the top left cell (1, 1) of an n × m labyrinth. Your goal is to get to the bottom right cell (n, m). You can only move right or down, one cell per step. Moving right from a cell (x, y) takes you to the cell (x, y + 1), while moving down takes you to the cell (x + 1, y).

Some cells of the labyrinth contain rocks. When you move to a cell with rock, the rock is pushed to the next cell in the direction you're moving. If the next cell contains a rock, it gets pushed further, and so on.

The labyrinth is surrounded by impenetrable walls, thus any move that would put you or any rock outside of the labyrinth is illegal.

Count the number of different legal paths you can take from the start to the goal modulo 10^9 + 7. Two paths are considered different if there is at least one cell that is visited in one path, but not visited in the other.

Input

The first line contains two integers n, m — dimensions of the labyrinth (1 ≤ n, m ≤ 2000).

Next n lines describe the labyrinth. Each of these lines contains m characters. The j-th character of the i-th of these lines is equal to "R" if the cell (i, j) contains a rock, or "." if the cell (i, j) is empty.

It is guaranteed that the starting cell (1, 1) is empty.

Output

Print a single integer — the number of different legal paths from (1, 1) to (n, m) modulo 10^9 + 7.

Examples

Input


1 1
.


Output


1


Input


2 3
...
..R


Output


0


Input


4 4
...R
.RR.
.RR.
R...


Output


4

Note

In the first sample case we can't (and don't have to) move, hence the only path consists of a single cell (1, 1).

In the second sample case the goal is blocked and is unreachable.

Illustrations for the third sample case can be found here: <https://assets.codeforces.com/rounds/1225/index.html>
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRockIsPush solver = new CRockIsPush();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRockIsPush {
        int[][] rock;
        int mod = 1000000007;
        int[][][] dp;
        int[][] prefixRow;
        int[][] prefixColumn;

        int sumQuery(int tli, int tlj, int rbi,
                     int rbj) {
            int res = rock[rbi][rbj];

            if (tli > 0)
                res = res - rock[tli - 1][rbj];

            if (tlj > 0)
                res = res - rock[rbi][tlj - 1];

            if (tli > 0 && tlj > 0)
                res = res + rock[tli - 1][tlj - 1];

            return res;
        }

        int sumQuery1(int tli, int tlj, int rbi,
                      int rbj) {
            if (tlj > rbj) return 0;
            if (tli > rbi) return 0;

            int res = prefixRow[rbi][rbj];

            if (tli > 0)
                res = res - prefixRow[tli - 1][rbj] + mod;
            if (res >= mod) res -= mod;

            if (tlj > 0)
                res = res - prefixRow[rbi][tlj - 1] + mod;
            if (res >= mod) res -= mod;

            if (tli > 0 && tlj > 0)
                res = res + prefixRow[tli - 1][tlj - 1];
            if (res >= mod) res -= mod;
            return res % mod;
        }

        int sumQuery2(int tli, int tlj, int rbi,
                      int rbj) {
            if (tlj > rbj) return 0;
            if (tli > rbi) return 0;
            int res = prefixColumn[rbi][rbj];

            if (tli > 0)
                res = res - prefixColumn[tli - 1][rbj] + mod;
            if (res >= mod) res -= mod;

            if (tlj > 0)
                res = res - prefixColumn[rbi][tlj - 1] + mod;
            if (res >= mod) res -= mod;

            if (tli > 0 && tlj > 0)
                res = res + prefixColumn[tli - 1][tlj - 1];
            if (res >= mod) res -= mod;
            return res % mod;
        }

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int m = in.scanInt();
            if (n == 1 && m == 1) {
                out.println(1);
                return;
            }
            char[][] ar = new char[n][];
            for (int i = 0; i < n; i++) ar[i] = in.scanString().toCharArray();
            rock = new int[n + 1][m + 1];
            prefixRow = new int[n + 1][m + 1];
            prefixColumn = new int[n + 1][m + 1];

            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++)
                    rock[i][j] = rock[i - 1][j] + rock[i][j - 1]
                            - rock[i - 1][j - 1] + (ar[i - 1][j - 1] == 'R' ? 1 : 0);
            }
            dp = new int[n + 1][m + 1][2];
            dp[1][1][0] = 1;
            dp[1][1][1] = 1;
            prefixRow[1][1] = 1;
            prefixColumn[1][1] = 1;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (i == 1 && j == 1) continue;
                    // zero
                    {

                        int low = 1;
                        int high = j - 1;
                        int index = -1;
                        while (low <= high) {
                            int mid = (low + high) >> 1;
                            if (sumQuery(i, mid + 1, i, m) <= m - j) {
                                index = mid;
                                high = mid - 1;
                            } else {
                                low = mid + 1;
                            }
                        }
                        if (index != -1) {
                            dp[i][j][0] = dp[i][j][0] + sumQuery2(i, index, i, j - 1);
                            if (dp[i][j][0] >= mod) dp[i][j][0] -= mod;
                        }
                    }
                    //one
                    {
                        int low = 1;
                        int high = i - 1;
                        int index = -1;
                        while (low <= high) {
                            int mid = (low + high) >> 1;
                            if (sumQuery(mid + 1, j, n, j) <= n - i) {
                                index = mid;
                                high = mid - 1;
                            } else {
                                low = mid + 1;
                            }
                        }
                        if (index != -1) {
                            dp[i][j][1] = dp[i][j][1] + sumQuery1(index, j, i - 1, j);
                            if (dp[i][j][1] >= mod) dp[i][j][1] -= mod;
                        }
                    }

                    {
                        prefixRow[i][j] = prefixRow[i - 1][j];
                        prefixRow[i][j] = prefixRow[i][j] + prefixRow[i][j - 1];
                        if (prefixRow[i][j] >= mod) prefixRow[i][j] -= mod;
                        prefixRow[i][j] -= prefixRow[i - 1][j - 1];
                        if (prefixRow[i][j] < 0) prefixRow[i][j] += mod;
                        prefixRow[i][j] += dp[i][j][0];
                        if (prefixRow[i][j] >= mod) prefixRow[i][j] -= mod;
                    }
                    {
                        prefixColumn[i][j] = prefixColumn[i - 1][j];
                        prefixColumn[i][j] = prefixColumn[i][j] + prefixColumn[i][j - 1];
                        if (prefixColumn[i][j] >= mod) prefixColumn[i][j] -= mod;
                        prefixColumn[i][j] -= prefixColumn[i - 1][j - 1];
                        if (prefixColumn[i][j] < 0) prefixColumn[i][j] += mod;
                        prefixColumn[i][j] += dp[i][j][1];
                        if (prefixColumn[i][j] >= mod) prefixColumn[i][j] -= mod;
                    }
                }
            }
            out.println((dp[n][m][0] + dp[n][m][1]) % mod);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        public String scanString() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return res.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

