#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXN = 100005;
int N, K, X, Y;
char C;
vector<int> L[2], R[2], V[2];
int main() {
  cin >> N >> K;
  for (int i = 0; i < K; i++) {
    cin >> X >> Y >> C;
    X--, Y--;
    int p = (X + Y) % 2;
    if (N % 2 == 0) {
      if (p == 0) {
        L[p].push_back(abs(X - Y) / 2);
        if ((X + Y) / 2 < N / 2)
          R[p].push_back((X + Y) / 2);
        else
          R[p].push_back(N - 1 - (X + Y) / 2);
        V[p].push_back(C == 'o');
      } else {
        L[p].push_back(abs(X - Y) / 2);
        R[p].push_back(N / 2 - 1 - abs(N / 2 - 1 - (X + Y) / 2));
        V[p].push_back(C == 'o');
      }
    } else {
      if (p == 0) {
        L[p].push_back(abs(X - Y) / 2);
        R[p].push_back(N / 2 - abs(N / 2 - (X + Y) / 2));
        V[p].push_back(C == 'o');
      } else {
        L[p].push_back(abs(X - Y) / 2);
        if ((X + Y) / 2 < N / 2)
          R[p].push_back((X + Y) / 2);
        else
          R[p].push_back(N - 2 - (X + Y) / 2);
        V[p].push_back(C == 'o');
      }
    }
  }
  int res = 1;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < V[i].size(); j++) R[i][j]++;
    vector<int> adj[MAXN], wt[MAXN];
    int vis[MAXN] = {}, col[MAXN] = {};
    for (int j = 0; j < V[i].size(); j++) {
      adj[L[i][j]].push_back(R[i][j]);
      adj[R[i][j]].push_back(L[i][j]);
      wt[L[i][j]].push_back(V[i][j]);
      wt[R[i][j]].push_back(V[i][j]);
    }
    vis[0] = 1;
    col[0] = 0;
    for (int j = 1; j <= (N - i + 1) / 2; j++) {
      if (!vis[j]) {
        int cnt = 0;
        vis[j] = 1;
        for (int l = 0; l < 2; l++) {
          bool ok = 1;
          vector<int> n;
          col[j] = l;
          queue<int> q;
          q.push(j);
          while (q.size()) {
            int c = q.front();
            q.pop();
            for (int k = 0; k < adj[c].size(); k++) {
              int nc = col[c] ^ wt[c][k];
              if (vis[adj[c][k]]) {
                ok &= (col[adj[c][k]] == nc);
              } else {
                col[adj[c][k]] = nc;
                q.push(adj[c][k]);
                vis[adj[c][k]] = 1;
                n.push_back(adj[c][k]);
              }
            }
          }
          if (l == 0) {
            for (int k = 0; k < n.size(); k++) vis[n[k]] = 0;
          }
          cnt += ok;
        }
        res *= cnt;
        res %= MOD;
      }
    }
  }
  cout << res << '\n';
}
