#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int n, m;
char g[N][N];
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
int d[N][N];
bool vis[N][N];
vector<pair<pair<int, int>, int> > ans;
void bfs(int x, int y) {
  queue<pair<int, int> > q;
  memset(d, -1, sizeof(d));
  q.push(make_pair(x, y));
  d[x][y] = 0;
  vis[x][y] = 1;
  vector<pair<int, pair<int, int> > > v;
  ans.push_back(make_pair(make_pair(x + 1, y + 1), 0));
  while (!q.empty()) {
    pair<int, int> u = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int nx = u.first + dx[i], ny = u.second + dy[i];
      if (nx < 0 || ny < 0 || nx == n || ny == m || g[nx][ny] == '#' ||
          d[nx][ny] != -1)
        continue;
      ans.push_back(make_pair(make_pair(nx + 1, ny + 1), 0));
      d[nx][ny] = d[u.first][u.second] + 1;
      vis[nx][ny] = 1;
      v.push_back(make_pair(-d[nx][ny], make_pair(nx, ny)));
      q.push(make_pair(nx, ny));
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == 0) break;
    ans.push_back(
        make_pair(make_pair(v[i].second.first + 1, v[i].second.second + 1), 2));
    ans.push_back(
        make_pair(make_pair(v[i].second.first + 1, v[i].second.second + 1), 1));
  }
}
int main() {
  scanf("%d%d", &n, &m);
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) scanf("%s", g[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (g[i][j] == '.' && !vis[i][j]) bfs(i, j);
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i].second == 0)
      printf("B");
    else if (ans[i].second == 1)
      printf("R");
    else
      printf("D");
    printf(" %d %d\n", ans[i].first.first, ans[i].first.second);
  }
  return 0;
}
