#include <bits/stdc++.h>
using namespace std;
const int N = 503;
int m, n, vis[N][N];
vector<int> adj[N * N];
void init() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int id(int x, int y) { return (x - 1) * n + y; }
struct ds {
  char c;
  int x, y;
};
vector<ds> V;
void print(int u, int cc, int type = -1) {
  int x = (u - 1) / n + 1, y = u - (x - 1) * n;
  if (adj[u].size() == 0 && !type) {
    V.push_back((ds){'R', x, y});
    return;
  }
  V.push_back((ds){'B', x, y});
  for (int v : adj[u]) print(v, cc, 0);
  if (!type) V.push_back((ds){'D', x, y}), V.push_back((ds){'R', x, y});
}
int cc = 0;
queue<pair<int, int> > Q;
int hang[4] = {0, 0, 1, -1};
int cot[4] = {1, -1, 0, 0};
void build(int orgx, int orgy, int cc) {
  vis[orgx][orgy] = cc;
  Q.push({orgx, orgy});
  while (Q.size()) {
    int x = Q.front().first, y = Q.front().second;
    Q.pop();
    for (int t = 0; t <= (int)3; ++t) {
      int nx = x + hang[t], ny = y + cot[t];
      if (nx < 1 || nx > m || ny < 1 || ny > n || vis[nx][ny]) continue;
      adj[id(x, y)].push_back(id(nx, ny));
      vis[nx][ny] = cc;
      Q.push({nx, ny});
    }
  }
  print(id(orgx, orgy), cc);
}
void solve() {
  cin >> m >> n;
  for (int i = 1; i <= (int)m; ++i)
    for (int j = 1; j <= (int)n; ++j) {
      char c;
      cin >> c;
      if (c == '#') vis[i][j] = -1;
    }
  for (int i = 1; i <= (int)m; ++i)
    for (int j = 1; j <= (int)n; ++j)
      if (!vis[i][j]) build(i, j, ++cc);
  cout << V.size() << '\n';
  for (ds it : V) cout << it.c << ' ' << it.x << ' ' << it.y << '\n';
}
int main() {
  init();
  solve();
}
