#include <bits/stdc++.h>
using namespace std;
int numclouds;
struct node {
  node *parent;
  bool change;
  node() : parent(this), change(false) {}
  void moveUp() {
    if (parent->parent != parent) {
      parent->moveUp();
      change ^= parent->change;
      parent = parent->parent;
    }
  }
};
bool merge(node *a, node *b, bool change) {
  a->moveUp();
  b->moveUp();
  change = change ^ a->change ^ b->change;
  a = a->parent;
  b = b->parent;
  if (a == b) return !change;
  b->parent = a;
  b->change = change;
  --numclouds;
  return true;
}
int main() {
  node group[100001];
  int n, k;
  cin >> n >> k;
  numclouds = n;
  while (k-- > 0) {
    int a, b;
    char c;
    cin >> a >> b >> c;
    int g1 = a + b - 1, g2 = abs(a - b) - 1;
    if (!merge(group + max(g2, 0), group + min(g1, 2 * n - g1), c == 'o')) {
      cout << 0 << endl;
      return 0;
    }
  }
  int config = 1;
  while (numclouds-- > 0) config = (2 * config) % 1000000007;
  cout << config << endl;
  return 0;
}
