#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
class DSU {
  int n;
  vector<int> up;
  int find(int x) {
    if (up[x] < 0) return (x);
    up[x] = find(up[x]);
    return (up[x]);
  }
  void join(int a, int b) {
    int x = find(a);
    int y = find(b);
    if (x == y) return;
    up[y] = x;
  }

 public:
  DSU() { n = 0; }
  DSU(int n) {
    this->n = n;
    up.assign(2 * n + 7, -1);
  }
  void add(int l, int r, int k) {
    for (int i = 0, _n = (2); i < _n; i = i + 1)
      join(2 * l + i, 2 * r + (i ^ k));
  }
  int count(void) {
    for (int i = 0, _n = (n + 1); i < _n; i = i + 1)
      if (find(2 * i) == find(2 * i + 1)) return (0);
    int cnt = 0;
    for (int i = 0, _n = (2 * n + 2); i < _n; i = i + 1)
      if (up[i] < 0) cnt++;
    int res = 1;
    for (int zz = 0, _n = ((cnt - 2) / 2); zz < _n; zz = zz + 1)
      res = 2 * res % mod;
    return (res);
  }
};
inline int Abs(int x) { return (x < 0 ? -x : x); }
inline int ceil(int x, int y) { return (x / y + (x % y > 0)); }
int n, m;
DSU dsu[2];
void process(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0, _n = (2); i < _n; i = i + 1) dsu[i] = DSU(n);
  for (int i = (1), _b = (n); i <= _b; i = i + 1)
    dsu[(i + 1) & 1].add(i - 1, i, 0);
  for (int zz = 0, _n = (m); zz < _n; zz = zz + 1) {
    int x, y;
    char c;
    scanf("%d%d %c", &x, &y, &c);
    int L = Abs(x - y) + 1;
    int R = min(x + y - 1, 2 * n + 1 - (x + y));
    dsu[(x + y + 1) & 1].add(L - 1, R, c == 'o');
  }
  printf("%d", 1LL * dsu[0].count() * dsu[1].count() % mod);
}
int main(void) {
  process();
  return 0;
}
