#include <bits/stdc++.h>
using namespace std;
const int nn = 110000;
struct node {
  int n, N, f[nn];
  void init(int _n) {
    n = _n * 2;
    N = _n;
    for (int i = 0; i <= n - 1; ++i) f[i] = i;
  }
  int find(int x) {
    if (f[x] != x) f[x] = find(f[x]);
    return f[x];
  }
  void merge(int x, int y) {
    int fx = find(x);
    int fy = find(y);
    if (fx == fy) return;
    n--;
    f[fx] = fy;
  }
  bool fail() {
    for (int i = 0; i <= N - 1; ++i)
      if (find(i * 2) == find(i * 2 + 1)) return 1;
    return 0;
  }
} t0, t1;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  t1.init(n / 2 + 1);
  t0.init((n + 1) / 2 + 1);
  while (k--) {
    int x, y, z;
    char s[3];
    scanf("%d%d%s", &x, &y, s);
    x--;
    y--;
    if (s[0] == 'o')
      z = 1;
    else
      z = 0;
    int l = abs(x - y);
    int r = min(x + y, 2 * (n - 1) - x - y);
    if ((x + y) % 2 == 0) {
      x = l;
      y = r;
      if (x & 1) x++;
      if (y & 1) y--;
      x /= 2;
      y /= 2;
      y++;
      t0.merge(x * 2, y * 2 + z);
      t0.merge(x * 2 + 1, y * 2 + z ^ 1);
    } else {
      x = l;
      y = r;
      if (!(x & 1)) x++;
      if (!(y & 1)) y--;
      x = x / 2;
      y = y / 2;
      y++;
      t1.merge(x * 2, y * 2 + z);
      t1.merge(x * 2 + 1, y * 2 + z ^ 1);
    }
  }
  if (t0.fail() || t1.fail()) {
    puts("0");
    return 0;
  }
  int ans = 1, mod = (1e+9) + 7;
  for (int i = 1; i <= (t0.n + t1.n) / 2 - 2; ++i) ans = ans * 2 % mod;
  printf("%d\n", ans);
  return 0;
}
