func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class X, class Y>   bool minimize(X &x, const Y &y) {     X eps = 1e-9;     if (x > y + eps) {       x = y;       return true;     } else       return false;   }   template <class X, class Y>   bool maximize(X &x, const Y &y) {     X eps = 1e-9;     if (x + eps < y) {       x = y;       return true;     } else       return false;   }   template <class T>   T Abs(const T &x) {     return (x < 0 ? -x : x);   }   const int MOD = (int)1e9 + 7;   int numRow, numCol;   char board[2020][2020];   int range[2020][2020][2], limit[2020][2020][2];   int numWay[2020][2020][2], sumRow[2020][2020][2], sumCol[2020][2020][2];   void init(void) {     scanf( %d%d , &numRow, &numCol);     for (int i = (1), _b = (numRow); i <= _b; i++) scanf( %s , board[i] + 1);     if (board[1][1] ==  R  || board[numRow][numCol] ==  R ) {       cout << 0 << endl;       exit(EXIT_SUCCESS);     }     if (numRow == 1 && numCol == 1) {       cout << 1 << endl;       exit(EXIT_SUCCESS);     }   }   void add(int &x, const int &y) {     x += y;     if (x >= MOD) x -= MOD;   }   int sum(int x, int y) { return x + y >= MOD ? x + y - MOD : x + y; }   int diff(int x, int y) { return x < y ? x - y + MOD : x - y; }   void optimize(void) {     for (int i = (1), _b = (numRow); i <= _b; i++) {       int cntRock = 0;       for (int j = (numCol), _a = (1); j >= _a; j--) {         range[i][j][1] = numCol - cntRock;         if (board[i][j] ==  R ) cntRock++;       }       int k = numCol;       for (int j = (numCol), _a = (1); j >= _a; j--) {         while (k >= 1 && range[i][k][1] >= j) k--;         k++;         limit[i][j][1] = k;       }     }     for (int j = (1), _b = (numCol); j <= _b; j++) {       int cntRock = 0;       for (int i = (numRow), _a = (1); i >= _a; i--) {         range[i][j][0] = numRow - cntRock;         if (board[i][j] ==  R ) cntRock++;       }       int k = numRow;       for (int i = (numRow), _a = (1); i >= _a; i--) {         while (k >= 1 && range[k][j][0] >= i) k--;         k++;         limit[i][j][0] = k;       }     }     for (int i = (2), _b = (numRow); i <= _b; i++) {       if (i <= range[1][1][0]) numWay[i][1][0] = 1;       sumCol[i][1][0] = sum(sumCol[i - 1][1][0], numWay[i][1][0]);       sumRow[i][1][0] = numWay[i][1][0];     }     for (int j = (2), _b = (numCol); j <= _b; j++) {       if (j <= range[1][1][1]) numWay[1][j][1] = 1;       sumRow[1][j][1] = sum(sumRow[1][j - 1][1], numWay[1][j][1]);       sumCol[1][j][1] = numWay[1][j][1];     }     for (int i = (2), _b = (numRow); i <= _b; i++)       for (int j = (2), _b = (numCol); j <= _b; j++) {         int k = limit[i][j][1];         numWay[i][j][1] = diff(sumRow[i][j - 1][0], sumRow[i][k - 1][0]);         k = limit[i][j][0];         numWay[i][j][0] = diff(sumCol[i - 1][j][1], sumCol[k - 1][j][1]);         for (int k = 0, _n = (2); k < _n; k++) {           sumRow[i][j][k] = sum(sumRow[i][j - 1][k], numWay[i][j][k]);           sumCol[i][j][k] = sum(sumCol[i - 1][j][k], numWay[i][j][k]);         }       }     printf( %d n , sum(numWay[numRow][numCol][1], numWay[numRow][numCol][0]));   }   int main(void) {     init();     optimize();     return 0;   }   