#include <bits/stdc++.h>
using namespace std;
char M[550][550];
char achou[550][550];
pair<int, int> pai[550][550];
int dist[550][550];
int n, m;
pair<int, int> find(int x, int y) {
  return pai[x][y] = (pai[x][y] == pair<int, int>(x, y))
                         ? pair<int, int>(x, y)
                         : find(pai[x][y].first, pai[x][y].second);
}
void merge(int xa, int ya, int xb, int yb) {
  pair<int, int> A = find(xa, ya);
  pair<int, int> B = find(xb, yb);
  pai[A.first][A.second] = B;
}
struct tr {
  char ch;
  int a, b;
  tr(char ch = 0, int a = 0, int b = 0) : ch(ch), a(a), b(b) {}
};
queue<tr> ans;
vector<pair<int, int> > V;
void dfs(int x, int y, int d) {
  if (x < 0 || y < 0 || x >= n || y >= m) return;
  if (achou[x][y] || M[x][y] == '#') return;
  achou[x][y] = 1;
  dist[x][y] = d;
  V.push_back(pair<int, int>(x, y));
  dfs(x + 1, y, d + 1);
  dfs(x - 1, y, d + 1);
  dfs(x, y + 1, d + 1);
  dfs(x, y - 1, d + 1);
}
bool comp(pair<int, int> a, pair<int, int> b) {
  return dist[a.first][a.second] > dist[b.first][b.second];
}
int main() {
  scanf("%d%d", &n, &m);
  getchar();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      M[i][j] = getchar();
      if (M[i][j] == '.') ans.push(tr('B', i, j));
    }
    getchar();
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) pai[i][j] = pair<int, int>(i, j);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (achou[i][j] || M[i][j] == '#') continue;
      V.clear();
      ;
      dfs(i, j, 0);
      if (V.empty()) continue;
      sort(V.begin(), V.end(), comp);
      for (vector<pair<int, int> >::iterator it = V.begin(); it < --V.end();
           it++) {
        ;
        ans.push(tr('D', it->first, it->second));
        ans.push(tr('R', it->first, it->second));
      }
    }
  }
  printf("%d\n", ans.size());
  while (!ans.empty()) {
    tr k = ans.front();
    ans.pop();
    printf("%c %d %d\n", k.ch, k.a + 1, k.b + 1);
  }
}
