#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 25, JYY = 1e9 + 7;
int read() {
  int x = 0, y = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') y = (ch == '-' ? -1 : 1), ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * y;
}
int qpow(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = 1ll * x * x % JYY)
    if (y & 1) res = 1ll * res * x % JYY;
  return res;
}
int fa[M];
int find(int x) {
  if (fa[x] != x) fa[x] = find(fa[x]);
  return fa[x];
}
void unionn(int x, int y) {
  int fx = find(x), fy = find(y);
  fa[fx] = fy;
}
char s[5];
void solve() {
  int n = read(), m = read();
  for (int i = 0; i <= n * 2 + 3; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    scanf("%s", s);
    int l = max(x - y, y - x), r = min(x + y, n * 2 - x - y + 2);
    if (s[0] == 'o')
      unionn(l * 2, r * 2 + 1), unionn(l * 2 + 1, r * 2);
    else
      unionn(l * 2, r * 2), unionn(l * 2 + 1, r * 2 + 1);
  }
  int cnt = 0;
  for (int i = 0; i <= n + 1; i++)
    if (find(i * 2) == find(i * 2 + 1)) return (void)(printf("0\n"));
  for (int i = 0; i <= n * 2 + 3; i++)
    if (find(i) == i) cnt++;
  printf("%d\n", qpow(2, cnt / 2 - 2));
}
signed main() { solve(); }
