#include <bits/stdc++.h>
using namespace std;
int n, k;
struct sq {
  int x, y;
  char ind;
} s[100005];
int par[100005];
bool dist[100005];
int find(int l) {
  if (par[l] == l)
    return l;
  else {
    int temp = par[l];
    par[l] = find(par[l]);
    dist[l] = dist[l] ^ dist[temp];
    return par[l];
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d %d %c", &s[i].x, &s[i].y, &s[i].ind);
  }
  for (int i = 1; i <= n + 2; i++) par[i] = i, dist[i] = 0;
  for (int i = 1; i <= k; i++) {
    int l = s[i].y - s[i].x + 1;
    if (l < 1) l = 2 - l;
    int r = s[i].y + s[i].x - 1;
    if (r > n) r = n + n - r;
    r += 2;
    int fl = find(l), fr = find(r);
    if (fl == fr) {
      if (s[i].ind == 'o' && dist[l] == dist[r]) {
        printf("0\n");
        return 0;
      } else if (s[i].ind == 'x' && dist[l] != dist[r]) {
        printf("0\n");
        return 0;
      }
    } else {
      par[fl] = fr;
      dist[fl] = dist[l] ^ dist[r] ^ (s[i].ind == 'o');
    }
  }
  int cnt = -2, ans = 1;
  for (int i = 1; i <= n + 2; i++) {
    if (find(par[i]) == i) cnt++;
  }
  while (cnt--) {
    ans *= 2;
    if (ans >= 1000000007) ans -= 1000000007;
  }
  printf("%d\n", ans);
  return 0;
}
