#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
vector<pair<int, int> > a[110000];
int v[110000], d[110000];
int n, m;
int main() {
  int i, k, x, y, z, l, r, ans, flag, cnt;
  char tmp[10];
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d%d%s", &x, &y, tmp);
    if (x <= y)
      l = y - x + 1;
    else
      l = x - y + 1;
    if (x >= n - y + 1)
      r = n - (x - (n - y + 1));
    else
      r = n - ((n - y + 1) - x);
    a[l].push_back(pair<int, int>(r + 2, tmp[0] == 'o'));
    a[r + 2].push_back(pair<int, int>(l, tmp[0] == 'o'));
  }
  ans = 1;
  cnt = 0;
  flag = 0;
  for (k = 1; k <= n + 2; k++)
    if (!v[k]) {
      cnt++;
      if (cnt > 2) ans = ans * 2 % 1000000007;
      queue<int> Q;
      Q.push(k);
      v[k] = 1;
      while (!Q.empty()) {
        x = Q.front();
        Q.pop();
        for (i = 0; i < a[x].size(); i++) {
          y = a[x][i].first;
          z = a[x][i].second;
          if (!v[y]) {
            d[y] = d[x] ^ z;
            v[y] = 1;
            Q.push(y);
          } else
            flag |= d[y] != (d[x] ^ z);
        }
      }
    }
  if (flag) ans = 0;
  printf("%d\n", ans);
}
