#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double PI = atan(1.0) * 4;
const int inf = ~0U >> 1;
const int DX[] = {1, 0, -1, 0}, DY[] = {0, 1, 0, -1};
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
int sgn(T first) {
  return (first > eps) - (first < -eps);
}
const int maxn = int(1e5) + 9;
const int mod = 1000000007;
struct Edge {
  int v, w;
  Edge() {}
  Edge(int v, int w) : v(v), w(w) {}
};
int n;
bool ans_u;
int col[maxn];
vector<Edge> pat[maxn];
void add(int u, int v, int w) {
  pat[u].push_back(Edge(v, w));
  pat[v].push_back(Edge(u, w));
}
void constraint(int r, int c, int v) {
  int L = abs(r - c) + 1;
  int R = r + c - 1;
  chmin(R, 2 * n - R);
  L -= 2;
  chmax(L, 0);
  add(L, R, v);
}
void dfs(int first, int c) {
  if (~col[first]) {
    if (col[first] != c) ans_u = true;
    return;
  }
  col[first] = c;
  for (__typeof((pat[first]).begin()) i = (pat[first]).begin();
       i != (pat[first]).end(); ++i) {
    dfs(i->v, c ^ i->w);
  }
}
int main() {
  int k;
  scanf("%d%d", &n, &k);
  while (k--) {
    char ch;
    int r, c;
    scanf("%d %d %c", &r, &c, &ch);
    constraint(r, c, ch == 'o');
  }
  memset(col, -1, sizeof(col));
  ans_u = false;
  dfs(0, 0);
  int cnt = 0;
  for (int i = (1); i <= (int)(n); i++) {
    if (col[i] == -1) dfs(i, 0), ++cnt;
    if (ans_u) break;
  }
  int ans = !ans_u;
  while (cnt--) ans = (ans + ans) % mod;
  printf("%d\n", ans);
  return 0;
}
