#include <bits/stdc++.h>
using namespace std;
const int maxn = 5 * 100 + 5;
int n, m, d = 0;
int mark[maxn][maxn], h[maxn][maxn];
vector<pair<int, int> > heigh[500000];
string s[maxn];
void dfs(int x, int y) {
  mark[x][y] = 1;
  heigh[h[x][y]].push_back({x, y});
  if (x - 1 > 0 && mark[x - 1][y] != 1 && s[x - 1][y] == '.') {
    h[x - 1][y] = h[x][y] + 1;
    dfs(x - 1, y);
  }
  if (x + 1 <= n && mark[x + 1][y] != 1 && s[x + 1][y] == '.') {
    h[x + 1][y] = h[x][y] + 1;
    dfs(x + 1, y);
  }
  if (y + 1 <= m && mark[x][y + 1] != 1 && s[x][y + 1] == '.') {
    h[x][y + 1] = h[x][y] + 1;
    dfs(x, y + 1);
  }
  if (y - 1 > 0 && mark[x][y - 1] != 1 && s[x][y - 1] == '.') {
    h[x][y - 1] = h[x][y] + 1;
    dfs(x, y - 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    string t = "-";
    t += s[i];
    s[i] = t;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '.') d++;
      if (mark[i][j] != 1 && s[i][j] == '.') {
        h[i][j] = 0;
        dfs(i, j);
      }
    }
  }
  int cnt = 0;
  cout << ((long long)d - (long long)heigh[0].size()) * 3 +
              (long long)heigh[0].size()
       << "\n";
  for (int i = 0; heigh[i].size() > 0; i++, cnt++) {
    for (int j = 0; j < heigh[i].size(); j++) {
      cout << "B " << heigh[i][j].first << " " << heigh[i][j].second << "\n";
    }
  }
  for (; cnt > 0; cnt--) {
    for (int i = 0; i < heigh[cnt].size(); i++) {
      cout << "D " << heigh[cnt][i].first << " " << heigh[cnt][i].second
           << "\n";
    }
    for (int i = 0; i < heigh[cnt].size(); i++) {
      cout << "R " << heigh[cnt][i].first << " " << heigh[cnt][i].second
           << "\n";
    }
  }
}
