unittest
{
	assert( [ "3 4", "...#", ".#..", "...." ].parse.expand.solve == 3 );
	assert( [ "5 2", "..", "#.", "..", ".#", ".." ].parse.expand.solve == 0 );
	assert( [ "5 5", "..#..", ".....", "#...#", ".....", "..#.." ].parse.expand.solve == 24 );
	assert( [
		"20 20",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"....................",
		"...................." ].parse.expand.solve == 345263555 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto hw = input.front.split.to!( long[] );
	auto ass = new string[]( hw[ 0 ] );
	foreach( ref as; ass )
	{
		input.popFront;
		as = input.front;
	}
	return tuple( ass );
}

auto solve( string[] ass )
{
	const MOD = 10L ^^ 9 + 7;
	auto dp = new long[][]( ass.length, ass[ 0 ].length );
	
	dp[ 0 ][ 0 ] = 1;
	for( auto y = 0L; y < ass.length; y++ )
	{
		for( auto x = 0L; x < ass[ y ].length; x++ )
		{
			if( y + 1 < ass.length && ass[ y + 1 ][ x ] == '.' )
			{
				dp[ y + 1 ][ x ] = dp[ y ][ x ];
			}
			if( x + 1 < ass[ y ].length && ass[ y ][ x + 1 ] == '.' )
			{
				dp[ y ][ x + 1 ] = ( dp[ y ][ x ] + dp[ y ][ x + 1 ] ) % MOD;
			}
		}
	}
	
	return dp[ $ - 1 ][ $ - 1 ];
}
