#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 10;
const long long Mod = 1e9 + 7;
vector<long long> graph[MAXN];
;
vector<long long> vertex[MAXN];
vector<pair<long long, long long> > edge;
long long c[MAXN];
long long tc[MAXN];
long long comp[MAXN];
bool check[MAXN];
long long t, w1, w2;
void dfs(long long v) {
  check[v] = true;
  comp[v] = t;
  if (c[v] > 0) {
    if (tc[t] == 0) {
      tc[t] = c[v];
    } else {
      if (tc[t] != c[v]) {
        cout << 0;
        exit(0);
      }
    }
  }
  for (long long i = 0; i < vertex[v].size(); i++) {
    if (!check[vertex[v][i]]) {
      dfs(vertex[v][i]);
    }
  }
}
void bi_dfs(long long v, long long e) {
  check[v] = true;
  if (tc[v] == 0) {
    tc[v] = e;
  } else {
    w1 += (tc[v] == e);
    w2 += (tc[v] != e);
    tc[v] = e;
  }
  for (long long i = 0; i < graph[v].size(); i++) {
    if (!check[graph[v][i]]) {
      bi_dfs(graph[v][i], 3 - e);
    } else {
      if (tc[graph[v][i]] == tc[v]) {
        cout << 0;
        exit(0);
      }
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, k, res = 1;
  cin >> n >> k;
  for (long long i = 1; i <= k; i++) {
    long long x, y, e;
    cin >> x >> y;
    char type;
    cin >> type;
    e = (type == 'o');
    if (x > y) {
      swap(x, y);
    }
    if ((x + y) & 1) {
      y--;
      if (x == y) {
        c[n + x] = e + 1;
      } else {
        if (e) {
          edge.push_back(make_pair(n + (y - x) / 2, n + (x + y) / 2));
        } else {
          vertex[n + (y - x) / 2].push_back(n + (x + y) / 2);
          vertex[n + (x + y) / 2].push_back(n + (y - x) / 2);
        }
      }
    } else {
      if (x == y) {
        c[x] = e + 1;
      } else {
        if (e) {
          edge.push_back(make_pair((y - x) / 2, (x + y) / 2));
        } else {
          vertex[(y - x) / 2].push_back((x + y) / 2);
          vertex[(x + y) / 2].push_back((y - x) / 2);
        }
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    vertex[i].push_back(n - i + 1);
  }
  for (long long i = n + 1; i <= 2 * n - 1; i++) {
    vertex[i].push_back(3 * n - i);
  }
  for (long long i = 1; i <= 2 * n - 1; i++) {
    if (!check[i]) {
      t++;
      dfs(i);
    }
  }
  for (long long i = 0; i < edge.size(); i++) {
    graph[comp[edge[i].first]].push_back(comp[edge[i].second]);
    graph[comp[edge[i].second]].push_back(comp[edge[i].first]);
  }
  fill(check, check + MAXN, false);
  for (long long i = 1; i <= t; i++) {
    if (!check[i]) {
      w1 = 0;
      w2 = 0;
      bi_dfs(i, 1);
      if (w1 > 0 && w2 > 0) {
        cout << 0;
        return 0;
      }
      res *= ((w1 + w2) == 0 ? 2 : 1);
      res %= Mod;
    }
  }
  cout << res;
}
