#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 10;
int p[2 * maxn], cnt[2 * maxn];
char ss[11];
vector<pair<pair<int, int>, int> > v[2];
int get(int x) { return x == p[x] ? x : p[x] = get(p[x]); }
void doit(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (cnt[x] < cnt[y]) swap(x, y);
  p[y] = x;
  cnt[x] += cnt[y];
}
int main() {
  int n, k;
  cin >> n >> k;
  while (k--) {
    int a, b, c;
    scanf("%d%d%s", &a, &b, ss);
    --a;
    --b;
    c = ss[0] == 'o';
    int L, R;
    int mi = min(a, b);
    if (mi == a) {
      L = b - a;
    } else {
      L = a - b;
    }
    mi = min(a, n - 1 - b);
    if (mi == a) {
      R = a + b;
    } else {
      R = 2 * (n - 1) - a - b;
    }
    L /= 2;
    R /= 2;
    v[(a + b) % 2].push_back(make_pair(make_pair(L, R), c));
  }
  int ans = 1;
  for (int it = 0; it < 2; it++) {
    for (int i = 0; i < (n + 1 - it) / 2 * 2 + 2; i++) {
      p[i] = i;
      cnt[i] = 1;
    }
    for (int i = 0; i < (int)(v[it]).size(); i++) {
      int L = v[it][i].first.first;
      int R = v[it][i].first.second;
      int tmp = v[it][i].second;
      doit(2 * L, 2 * (R + 1) + tmp);
      doit(2 * L + 1, 2 * (R + 1) + 1 - tmp);
    }
    for (int i = 0; i < (n + 1 - it) / 2 + 1; i++) {
      if (get(2 * i) == get(2 * i + 1)) {
        cout << 0 << endl;
        return 0;
      }
    }
    int cur = 0;
    for (int i = 0; i < (n + 1 - it) / 2 * 2 + 2; i++) {
      if (p[i] == i) cur++;
    }
    cur -= 2;
    cur /= 2;
    int e = 1;
    while (cur > 0) {
      e += e;
      if (e >= mod) e -= mod;
      cur--;
    }
    ans = ans * 1LL * e % mod;
  }
  cout << ans << endl;
  return 0;
}
