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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Random;
import java.util.TreeSet;

public final class CF_596_D1_C
{


	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}

	static class Composite implements Comparable<Composite>{
		int v;
		int idx;
		public int compareTo(Composite X) {
			if (v!=X.v)
				return v-X.v;
			return idx-X.idx;
		}
		public Composite(int v, int idx) {
			this.v = v;
			this.idx = idx;
		}



	}

	static long mod=1000000007;

	// Global vars
	static BufferedWriter out;
	static InputReader reader;


	static void test() {
		log("testing");
		int NMAX=100;
		int NTESTS=10000;
		Random r=new Random();
		for (int t=0;t<NTESTS;t++) {
			int[] a=new int[NMAX];

		}
		log("done");

	}



	/*
	 long[][][][] dp=new long[n][m][2][nmx];
		dp[0][0][0][0]=1;
		dp[0][0][1][0]=0;
		for (int i=0;i<n;i++)
			for (int j=0;j<m;j++) 
				for (int d=0;d<2;d++)
				for (int e=0;e<2;e++)
					for (int k=0;k<nmx;k++) {
						int u=i+delta[e][0];
						int v=j+delta[e][1];
						if (u<n && v<m) {
							int nk=k;
							if (d!=e)
								nk=0;
							int ot=0;
							int rem=0;
							if (e==0) {
								ot=down[u][v];
								rem=n-u;
							}
							else {
								ot=right[u][v];
								rem=m-v;
							}
							int tot=nk+ot;
							if (tot<rem) {
								if (map[u].charAt(v)=='R')
									nk++;
								dp[u][v][e][nk]+=dp[i][j][d][k];
								if (dp[u][v][e][nk]>=mod)
									dp[u][v][e][nk]-=mod;
							}
						}


					}

		long ans=(dp[n-1][m-1][0][0]+dp[n-1][m-1][1][0])%mod;


	 */


	static class Bidon {
		int k;
		long w;

		public Bidon(int k, long w) {
			this.k = k;
			this.w = w;
		}


	}



	static long addMod(long a,long b,long mod) {
		long c=a+b;
		if (c>=mod)
			c-=mod;
		return c;
	}

	static void process() throws Exception {


		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader = new InputReader(System.in);

		int n=reader.readInt();
		int m=reader.readInt();
		String[] map=new String[n];
		for (int i=0;i<n;i++)
			map[i]=reader.readString();

		int nmx=Math.max(n, m);

		int[][] delta= {{1,0},{0,1}};
		// d the previous direction
		// e the direction we went
		int[][] right=new int[n][m];
		int[][] down=new int[n][m];
		for (int u=n-1;u>=0;u--)
			for (int v=m-1;v>=0;v--) {
				int ad=0;
				if (map[u].charAt(v)=='R')
					ad=1;
				right[u][v]=ad;
				down[u][v]=ad;
				if (v+1<m)
					right[u][v]+=right[u][v+1];
				if (u+1<n)
					down[u][v]+=down[u+1][v];
			}

		long[][][] dp=new long[n][m][2];



		// let's look only at the moment where we change direction

		long[][][] diff=new long[n][m][2];
		long[][][] sum=new long[n][m][2];
		diff[0][0][0]=1;
		diff[0][0][1]=1;

		if (1<n)
			diff[1][0][0]=mod-1;
		if (1<m)
			diff[0][1][1]=mod-1;


		for (int i=0;i<n;i++) {
			for (int j=0;j<m;j++) {

				if (i>0)
					sum[i][j][0]=sum[i-1][j][0];
				if (j>0)
					sum[i][j][1]=sum[i][j-1][1];

				for (int d=0;d<2;d++) {
					//sum[i][j][d]=addMod(sum[i][j][d],diff[i][j][d],mod);
					sum[i][j][d]+=diff[i][j][d];
					if (sum[i][j][d]>=mod)
						sum[i][j][d]-=mod;

					dp[i][j][d]=sum[i][j][d];
				}

				int d;
				// first from above
				d=0;
				// we have m-1-j elements at the right
				// of which right[j+1] are blocked
				// so m-1-j-right[j+1] are free

				if (dp[i][j][d]>0) {
					if (j+1<m) {
						int blck=right[i][j+1];
						int all=m-1-j;
						int rem=all-blck;


						//log("i:"+i+" j:"+j+" rem:"+rem);
						//diff[i][j+1][1-d]=addMod(diff[i][j+1][1-d],dp[i][j][d],mod);
						diff[i][j+1][1-d]+=dp[i][j][d];
						if (diff[i][j+1][1-d]>=mod)
							diff[i][j+1][1-d]-=mod;

						if (j+1+rem<m) {
							//diff[i][j+1+rem][1-d]=addMod(diff[i][j+1+rem][1-d],mod-dp[i][j][d],mod);
							diff[i][j+1+rem][1-d]+=mod-dp[i][j][d];
							if (diff[i][j+1+rem][1-d]>=mod)
								diff[i][j+1+rem][1-d]-=mod;
						}
					}
				}
				d=1;
				// we have n-1-i elements below
				// of which down[i+1] are blocked
				// so n-1-i-down[i+1] are free

				if (dp[i][j][d]>0) {
					if (i+1<n) {
						int blck=down[i+1][j];
						int all=n-1-i;
						int rem=all-blck;

						//diff[i+1][j][1-d]=addMod(diff[i+1][j][1-d],dp[i][j][d],mod);
						diff[i+1][j][1-d]+=dp[i][j][d];
						if (diff[i+1][j][1-d]>=mod)
							diff[i+1][j][1-d]-=mod;
						if (i+1+rem<n) {
							//diff[i+1+rem][j][1-d]=addMod(diff[i+1+rem][j][1-d],mod-dp[i][j][d],mod);
							diff[i+1+rem][j][1-d]+=mod-dp[i][j][d];
							if (diff[i+1+rem][j][1-d]>=mod)
								diff[i+1+rem][j][1-d]-=mod;
						}
					}
				}
			}
		}

		long ans=addMod(dp[n-1][m-1][0],dp[n-1][m-1][1],mod);
		if (n==1 && m==1)
			ans=1;
		output(ans);


		try {
			out.close();
		} catch (Exception e) {
		}

	}




	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}