#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int dr[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const int maxn = 505;
char place[maxn][maxn];
int n, m;
int k;
bool flag;
stack<pair<int, int> > s;
void dfs(int x, int y) {
  if (flag)
    flag = false;
  else
    s.push(make_pair(x, y));
  k += 3;
  place[x][y] = 'R';
  for (int i = 0; i < 4; i++) {
    if (place[x + dr[i][0]][y + dr[i][1]] == '.')
      dfs(x + dr[i][0], y + dr[i][1]);
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    k = 0;
    for (int i = 1; i <= n; i++) scanf("%s", place[i] + 1);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (place[i][j] == '.') {
          k -= 2;
          flag = true;
          dfs(i, j);
        }
    printf("%d\n", k);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (place[i][j] != '#') printf("B %d %d\n", i, j);
    while (!s.empty()) {
      printf("D %d %d\n", s.top().first, s.top().second);
      printf("R %d %d\n", s.top().first, s.top().second);
      s.pop();
    }
  }
  return 0;
}
