#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int mod = (int)1e9 + 7;
const long double INF = (long double)(1e3);
const int N = 100005;
int n, k, a, b, c;
vector<pair<int, int> > g[N];
int color[N];
void dfs(int x, int c) {
  if (color[x] != -1) return;
  color[x] = c;
  for (int(i) = 0; (i) < ((int)g[x].size()); ++(i))
    dfs(g[x][i].first, (c + g[x][i].second) % 2);
}
void query(int a, int b, int val) {
  int x = abs(a - b);
  int y = a + b;
  if (y > n - 1) y = 2 * (n - 1) - y;
  int p, q;
  if (x % 2 == 0) {
    p = n / 2 + x / 2;
    q = n / 2 + y / 2 + 1;
  } else {
    p = n / 2 - x / 2;
    q = n / 2 - y / 2 - 1;
  }
  g[p].push_back(make_pair(q, val));
  g[q].push_back(make_pair(p, val));
}
int main() {
  cin >> n >> k;
  string s;
  for (int i = 0; i < k; ++i) {
    scanf("%d %d", &a, &b);
    cin >> s;
    c = ((s == "o") ? 1 : 0);
    query(a - 1, b - 1, c);
  }
  int comp = -1;
  for (int(i) = 0; (i) < (n + 1); ++(i)) color[i] = -1;
  for (int(i) = 0; (i) < (n + 1); ++(i))
    if (color[i] == -1) {
      dfs(i, 0);
      ++comp;
    }
  bool bad = false;
  for (int(i) = 0; (i) < (n + 1); ++(i))
    for (int(j) = 0; (j) < ((int)g[i].size()); ++(j))
      if (color[g[i][j].first] != (color[i] + g[i][j].second) % 2) bad = true;
  if (bad) {
    cout << 0 << endl;
  } else {
    int ans = 1;
    for (int(i) = 0; (i) < (comp); ++(i)) ans = 2 * ans % 1000000007;
    cout << ans << endl;
  }
  return 0;
}
