#include <bits/stdc++.h>
using namespace std;
const int MAXN = 211111;
const long long Md = 1000000007;
int x[MAXN], y[MAXN], v[MAXN];
int fa[MAXN];
int n, m, k, cnt, ans;
char s[5];
int GetFa(int x) { return x == fa[x] ? x : fa[x] = GetFa(fa[x]); }
void Unite(int x, int y) {
  int fx = GetFa(x), fy = GetFa(y);
  if (fx != fy) {
    fa[fx] = fy;
    --cnt;
  }
}
long long Powe(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % Md;
    x = x * x % Md;
    y >>= 1;
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; ++i) {
    fa[i] = i;
    fa[i + n + 1] = i + n + 1;
  }
  cnt = 2 * (n + 1);
  for (int i = 1; i <= k; ++i) {
    scanf("%d%d%s", &x[i], &y[i], s);
    v[i] = s[0] == 'o' ? 1 : 0;
    int l = max(0, abs(x[i] - y[i]) - 1);
    int r = x[i] + y[i] - 1;
    if (r > n) r = 2 * n - r;
    if (v[i]) {
      Unite(r, l + n + 1);
      Unite(l, r + n + 1);
    } else {
      Unite(l, r);
      Unite(l + n + 1, r + n + 1);
    }
  }
  for (int i = 0; i <= n; ++i) {
    if (GetFa(i) == GetFa(i + n + 1)) {
      puts("0");
      return 0;
    }
  }
  printf("%lld\n", Powe(2ll, (cnt - 2) / 2));
  return 0;
}
