#include <bits/stdc++.h>   using namespace std;   const int N = 503;   char thien[N][N];   int n, m, visit[N][N];   vector<pair<int, int> > adj[N][N];   int hang[4] = {-1, 0, 1, 0};   int cot[4] = {0, 1, 0, -1};   struct ds {     char type;     int u, v;   };   vector<ds> Ans;   void DFS(int u, int v) {     visit[u][v] = true;     Ans.push_back({ B , u, v});     for (int dir = 0; dir < 4; ++dir) {       int nu = u + hang[dir], nv = v + cot[dir];       if (nu < 1 || nu > n || nv < 1 || nv > m || thien[nu][nv] ==  #  ||           visit[nu][nv])         continue;       adj[u][v].push_back({nu, nv}), DFS(nu, nv);     }   }   void phudo(int u, int v) {     for (auto it : adj[u][v]) {       int x = it.first, y = it.second;       phudo(x, y);       Ans.push_back({ D , x, y}), Ans.push_back({ R , x, y});     }   }   int main() {     if (fopen( trash.inp ,  r ))       freopen( trash.inp ,  r , stdin), freopen( trash.out ,  w , stdout);     cin >> n >> m;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) cin >> thien[i][j];     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j)         if (!visit[i][j] && thien[i][j] !=  # ) {           DFS(i, j);           phudo(i, j);         }     cout << Ans.size() <<   n ;     for (auto it : Ans) cout << it.type <<     << it.u <<     << it.v <<   n ;   }   