#include <bits/stdc++.h>
class UnionFind {
 private:
  std::vector<int> disj;
  std::vector<int> rank;

 public:
  UnionFind(int n) : disj(n), rank(n) {
    for (int i = 0; i < n; ++i) {
      disj[i] = i;
      rank[i] = 0;
    }
  }
  int root(int x) {
    if (disj[x] == x) {
      return x;
    }
    return disj[x] = root(disj[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) {
      return;
    }
    if (rank[x] < rank[y]) {
      disj[x] = y;
    } else {
      disj[y] = x;
      if (rank[x] == rank[y]) {
        ++rank[x];
      }
    }
  }
  bool is_same_set(int x, int y) { return root(x) == root(y); }
};
using namespace std;
const long long int mod = 1e9 + 7;
const int K = 100010;
int x[K], y[K], p[K];
struct cons {
  int a, b, c;
  cons(int a, int b, int c) : a(a), b(b), c(c) {}
};
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = (int)(0); i < (int)(k); i++) {
    char c;
    cin >> x[i] >> y[i] >> c;
    x[i]--, y[i]--;
    p[i] = c == 'o';
  }
  vector<cons> pool;
  for (int i = (int)(0); i < (int)(k); i++) {
    pool.push_back(cons(x[i] - y[i], x[i] + y[i], p[i]));
  }
  for (int i = (int)(0); i < (int)(n); i++) {
    pool.push_back(cons(-i - 1, i - 1, 0));
    pool.push_back(cons(i + 1, i - 1, 0));
    pool.push_back(cons(-i + n, i + n, 0));
    pool.push_back(cons(i - n, i + n, 0));
  }
  UnionFind uf(8 * n + 4);
  for (int i = (int)(0); i < (int)(pool.size()); i++) {
    cons c = pool[i];
    if (0) {
      cerr << "c.a"
           << "=" << c.a << "\n";
      cerr << "c.b"
           << "=" << c.b << "\n";
      cerr << "c.c"
           << "=" << c.c << "\n";
    }
    for (int d = (int)(0); d < (int)(2); d++) {
      uf.unite(2 * (c.a + n) + d, 4 * n + 2 + 2 * (c.b + 1) + (c.c + d) % 2);
    }
  }
  for (int i = (int)(0); i < (int)(4 * n); i++) {
    if (uf.is_same_set(2 * i, 2 * i + 1)) {
      cout << "0\n";
      return 0;
    }
  }
  set<int> conn;
  for (int i = (int)(0); i < (int)(8 * n + 4); i++) conn.insert(uf.root(i));
  int sz = conn.size();
  cerr << "sz"
       << "=" << sz << "\n";
  long long int ans = 1;
  for (int i = (int)(0); i < (int)(sz / 2 - 2); i++) ans = 2 * ans % mod;
  cout << ans << "\n";
}
