#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
const int N = 100010, MOD = (int)(1e9 + 7);
int uni[N], val[N], n, m;
int power(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return ret;
}
int getfa(int pos) {
  if (pos == uni[pos]) return pos;
  getfa(uni[pos]);
  val[pos] ^= val[uni[pos]];
  return uni[pos] = uni[uni[pos]];
}
void merge(int a, int b, int v) {
  if (getfa(a) == getfa(b)) {
    if ((val[a] ^ val[b]) != v) {
      puts("0");
      exit(0);
    }
  } else {
    int ta = getfa(a), tb = getfa(b);
    uni[ta] = tb;
    val[ta] = val[a] ^ val[b] ^ v;
  }
}
char tp[3];
int main() {
  read(n);
  for (int i = 0; i <= n; ++i) uni[i] = i;
  read(m);
  for (int i = 1, a, b, c; i <= m; ++i) {
    read(a), read(b);
    scanf("%s", tp);
    if (*tp == 'o')
      c = 1;
    else
      c = 0;
    int l = b - (a - 1);
    if (l < 1) l = 2 - l;
    int r = b + (a - 1);
    if (r > n) r = 2 * n - r;
    l = ((l - 1) >> 1) + 1;
    r = ((r - 1) >> 1) + 1;
    if ((a + b) & 1) {
      merge(l - 1, r, c);
    } else {
      if (l == 1)
        merge(0, (n >> 1) + r, c);
      else
        merge((n >> 1) + l - 1, (n >> 1) + r, c);
    }
  }
  int num = -1;
  for (int i = 0; i <= n; ++i)
    if (getfa(i) == i) ++num;
  printf("%d\n", power(2, num));
  return 0;
}
