#include <bits/stdc++.h>
using namespace std;
int n, k, n1, n2;
int p1[111111], p2[111111];
int find(int u, int p[]) { return u == p[u] ? u : p[u] = find(p[u], p); }
void unite(int u, int v, int p[]) {
  int x = find(u, p), y = find(v, p);
  if (x == y) return;
  p[y] = x;
}
void merge(int u, int v, int p[], bool ck) {
  if (!ck) {
    unite(2 * (u - 1), 2 * v, p);
    unite(2 * (u - 1) + 1, 2 * v + 1, p);
  } else {
    unite(2 * (u - 1) + 1, 2 * v, p);
    unite(2 * (u - 1), 2 * v + 1, p);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  n2 = ((n & 1 ? n : n - 1) + 1) / 2;
  n1 = (n & 1 ? n - 1 : n) / 2;
  for (int i = 0; i <= n + 5; ++i) p1[i] = p2[i] = i;
  int ret = 1, cnt;
  while (k--) {
    int a, b, s, e;
    char c[3];
    scanf("%d%d%s", &a, &b, c);
    s = 1 + b - a, e = b + a - 1;
    if (s < 1) s = 2 - s;
    if (e > n) e = 2 * n - e;
    if (!((a + b) & 1)) {
      s = (s + 1) / 2, e = (e + 1) / 2;
      s = max(1, s), e = min(n2, e);
      merge(s, e, p2, c[0] == 'o');
    } else {
      s /= 2, e /= 2;
      s = max(1, s), e = min(n1, e);
      merge(s, e, p1, c[0] == 'o');
    }
  }
  cnt = 0;
  for (int i = 0; i <= n1; ++i) {
    if (find(2 * i, p1) == find(2 * i + 1, p1)) ret = 0;
    if (find(2 * i, p1) == 2 * i) cnt++;
    if (find(2 * i + 1, p1) == 2 * i + 1) cnt++;
  }
  for (int i = 0; i < (cnt - 2) / 2; ++i) ret = ret * 2 % 1000000007;
  cnt = 0;
  for (int i = 0; i <= n2; ++i) {
    if (find(2 * i, p2) == find(2 * i + 1, p2)) ret = 0;
    if (find(2 * i, p2) == 2 * i) cnt++;
    if (find(2 * i + 1, p2) == 2 * i + 1) cnt++;
  }
  for (int i = 0; i < (cnt - 2) / 2; ++i) ret = ret * 2 % 1000000007;
  printf("%d\n", ret);
}
