#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
const long long mod = 1e9 + 7;
inline signed rd() {
  signed ans = 0;
  char last = ' ', ch = getchar();
  while (!(ch >= '0' && ch <= '9')) last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  if (last == '-') ans = -ans;
  return ans;
}
inline long long QPow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  long long d = a;
  if (b == 0)
    x = 1, y = 0;
  else {
    d = exgcd(b, a % b, y, x), y -= a / b * x;
  }
  return d;
}
const long double PI = 3.141592653589793115997963468544185161590576171875;
const long long maxn = 505;
char grid[maxn][maxn];
long long n, m;
struct ins {
  char op;
  long long x, y;
  ins(char o, long long xx, long long yy) { op = o, x = xx, y = yy; }
};
long long dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
vector<ins> ans;
bool vis[maxn][maxn];
struct node {
  long long x, y, id;
} nodes[maxn * maxn];
vector<node> g[maxn * maxn];
signed id[maxn][maxn];
long long tot = 0;
signed deg[maxn * maxn];
void dfs(signed x, signed y) {
  vis[x][y] = 1;
  for (long long i = 0; i < 4; i++) {
    if (x + dx[i] >= 1 && x + dx[i] <= n && y + dy[i] >= 1 && y + dy[i] <= m &&
        !vis[x + dx[i]][y + dy[i]]) {
      dfs(x + dx[i], y + dy[i]);
      node tmp = {x + dx[i], y + dy[i], ++tot};
      deg[id[x][y]]++;
      nodes[tot] = tmp;
      g[tmp.id].push_back({x, y, id[x][y]});
    }
  }
}
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> grid[i][j];
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++)
      if (grid[i][j] != '#')
        ans.push_back(ins('B', i, j));
      else
        vis[i][j] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (!vis[i][j])
        ++tot, nodes[tot] = {i, j, tot}, id[i][j] = tot, dfs(i, j);
    }
  }
  queue<long long> q;
  for (long long i = 1; i <= tot; i++)
    if (deg[i] == 0) q.push(i);
  while (q.size()) {
    long long tmp = q.front();
    q.pop();
    for (long long i = 0; i < g[tmp].size(); i++) {
      deg[g[tmp][i].id]--;
      if (deg[g[tmp][i].id] == 0) q.push(g[tmp][i].id);
      ans.push_back({'D', nodes[tmp].x, nodes[tmp].y});
      ans.push_back({'R', nodes[tmp].x, nodes[tmp].y});
    }
  }
  cout << ans.size() << endl;
  for (long long i = 0; i < ans.size(); i++)
    cout << ans[i].op << ' ' << ans[i].x << ' ' << ans[i].y << '\n';
  return 0;
}
