#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 500;
const long long mod = 1e9 + 7;
vector<pair<long long, long long> > ger[maxn];
bool vis[maxn];
bool gp[maxn];
long long lo[maxn];
long long ro[maxn];
char co[maxn];
void cal(long long n, long long k) {
  for (long long i = 0; i < k; i++) {
    long long x, y;
    char c;
    cin >> x >> y >> c;
    if (x > y) {
      swap(x, y);
    }
    if (x + y > n + 1) {
      long long w = x + y - (n + 1);
      x -= w;
      y -= w;
    }
    long long l = y - x + 1;
    long long r = x + y - 1;
    lo[i] = l;
    ro[i] = r;
    co[i] = c;
  }
}
void filll() {
  for (long long i = 0; i < maxn; i++) {
    ger[i].clear();
    vis[i] = 0;
    gp[i] = 0;
  }
}
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b = (b >> 1);
  }
  return ans;
}
bool dfs(long long a, bool k) {
  if (vis[a]) {
    if (gp[a] == k) {
      return 0;
    }
    return 1;
  }
  vis[a] = 1;
  gp[a] = k;
  for (auto v : ger[a]) {
    if (dfs(v.first, k ^ v.second)) {
      return 1;
    }
  }
  return 0;
}
long long find_dfs_ans(long long n) {
  long long ans = 0;
  for (long long i = 0; i <= n; i++) {
    if (vis[i] == 0) {
      if (dfs(i, 0)) {
        cout << 0;
        exit(0);
      }
      ans++;
    }
  }
  ans--;
  return ans;
}
int main() {
  long long n, k;
  cin >> n >> k;
  cal(n, k);
  for (long long i = 0; i < k; i++) {
    long long l = lo[i];
    long long r = ro[i];
    bool bo = (co[i] == 'o');
    if (l % 2 == 1) {
      l++;
      r++;
      l /= 2;
      r /= 2;
      ger[l - 1].push_back(make_pair(r, bo));
      ger[r].push_back(make_pair(l - 1, bo));
    }
  }
  long long ma;
  if (n % 2 == 0) {
    ma = (n - 1 + 1) / 2;
  } else {
    ma = (n + 1) / 2;
  }
  long long ans = find_dfs_ans(ma);
  filll();
  for (long long i = 0; i < k; i++) {
    long long l = lo[i];
    long long r = ro[i];
    bool bo = (co[i] == 'o');
    if (l % 2 == 0) {
      l /= 2;
      r /= 2;
      ger[l - 1].push_back(make_pair(r, bo));
      ger[r].push_back(make_pair(l - 1, bo));
    }
  }
  if (n % 2 == 0) {
    ma = n / 2;
  } else {
    ma = (n - 1) / 2;
  }
  ans += find_dfs_ans(ma);
  cout << poww(2, ans) << endl;
}
