#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
const int maxn = 300001;
const int mod = 1e9 + 7;
int x, y, z, n, m;
char c;
int f[maxn], two[maxn];
map<int, int> tree;
int fn[3];
int find(int k) {
  if (f[k] != k) f[k] = find(f[k]);
  return f[k];
}
inline void merge(int x, int y) {
  int fx = find(x);
  int fy = find(y);
  f[fx] = fy;
}
int main() {
  ios::sync_with_stdio(false);
  two[0] = 1;
  for (int i = 1; i <= 100000; i++) two[i] = two[i - 1] * 2 % mod;
  cin.tie(0);
  scanf("%d%d", &n, &m);
  fn[0] = 2 * n + 1;
  fn[1] = fn[0] + 1;
  for (int i = 1; i <= 2 * n + 2; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    getchar();
    c = getchar();
    z = (c == 'o') ? 1 : 0;
    int lefts = y - (x - 1);
    if (lefts <= 0) lefts = (2 - lefts);
    lefts -= 2;
    int rights = x + y - 1;
    if (rights > n) rights = n - (rights - n);
    if (lefts > 0) {
      if (z) {
        merge(2 * lefts, 2 * rights - 1);
        merge(2 * lefts - 1, 2 * rights);
      } else {
        merge(2 * lefts - 1, 2 * rights - 1);
        merge(2 * lefts, 2 * rights);
      }
    } else {
      merge(2 * rights - z, fn[0]);
      merge(2 * rights - 1 + z, fn[1]);
    }
  }
  int ans = 0;
  int f1 = find(2 * n + 1);
  int f2 = find(2 * n + 2);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int x = find(2 * i - 1);
    int y = find(2 * i);
    if (x == y) {
      ans = -1;
      break;
    }
    if (x != f1 && y != f1 && x != f2 && y != f2) {
      if (!tree[x]) tree[x] = ++cnt, ++ans;
      if (!tree[y]) tree[y] = ++cnt, ++ans;
    }
  }
  cout << ((ans == -1) ? (0) : (two[ans / 2])) << endl;
  fclose(stdin);
  return 0;
}
