#include <bits/stdc++.h>
using namespace std;
struct HASH {
  size_t operator()(const pair<int, int> &x) const {
    return hash<int>()(((int)x.first) ^ (((int)x.second) << 32));
  }
};
const int MAX_N = 1e5 + 5, MOD = 1e9 + 7;
int n, k, cnt, ans;
int Arr[3][MAX_N];
int table[3][3];
vector<pair<pair<int, int>, int> > Q[2];
vector<pair<int, int> > seg[MAX_N];
unordered_map<pair<int, int>, int, HASH> Map;
int _sum(int a, int b) {
  int c = a + b;
  if (MOD <= c) c -= MOD;
  return c;
}
int _mul(int a, int b) { return 1LL * a * b % MOD; }
int _Pow(int a, int b) {
  if (!b) return 1;
  int res = _Pow(a, b >> 1);
  res = _mul(res, res);
  if (b & 1) res = _mul(res, a);
  return res;
}
void prop(int ind) {
  if (n == 2) return;
  if (Arr[0][ind] + Arr[1][ind] > n + 1) {
    int tmp = Arr[0][ind];
    Arr[0][ind] = n + 1 - Arr[1][ind];
    Arr[1][ind] = n + 1 - tmp;
  }
  if (Arr[0][ind] > Arr[1][ind]) swap(Arr[0][ind], Arr[1][ind]);
}
void rotate(int ind) {
  int tmp = Arr[0][ind];
  Arr[0][ind] = Arr[1][ind];
  Arr[1][ind] = n - tmp + 1;
}
bool Add(int s, int e, int o) {
  if (Map[{s, e}]) {
    if (Map[{s, e}] != o) return false;
    cnt--;
    return true;
  }
  Map[{s, e}] = o;
  seg[s].push_back({e, o});
  return true;
}
void refresh() {
  for (int i = 0; i < MAX_N; i++) seg[i].clear();
  Map.clear();
}
bool can() {
  if (((table[1][2] == 2) + (table[2][1] == 2)) % 2 != 0) return false;
  if (((table[1][1] == 2) + (table[2][2] == 2)) % 2 != 0) return false;
  return true;
}
void bt(int x, int y) {
  if (x == 3) {
    ans += can();
    return;
  }
  if (table[x][y])
    bt(x + (y == n), y % n + 1);
  else {
    table[x][y] = 1;
    bt(x + (y == n), y % n + 1);
    table[x][y] = 2;
    bt(x + (y == n), y % n + 1);
    table[x][y] = 0;
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  cnt = k;
  for (int i = 1; i <= k; i++) {
    char c;
    cin >> Arr[0][i] >> Arr[1][i] >> c;
    Arr[2][i] = (c == 'o' ? 2 : 1);
    prop(i);
    int L = Arr[1][i] - Arr[0][i] + 1;
    int R = Arr[1][i] + Arr[0][i] - 1;
    L = (L + 1) >> 1;
    R = (R + 1) >> 1;
    R++;
    Q[(Arr[0][i] + Arr[1][i]) & 1].push_back({{L, R}, Arr[2][i]});
  }
  if (n == 2) {
    for (int i = 1; i <= k; i++) {
      if (table[Arr[0][i]][Arr[1][i]])
        if (table[Arr[0][i]][Arr[1][i]] != Arr[2][i]) {
          cout << "0\n";
          return 0;
        }
      table[Arr[0][i]][Arr[1][i]] = Arr[2][i];
    }
    bt(1, 1);
    cout << ans << "\n";
    return 0;
  }
  for (int type = 0; type < 2; type++) {
    for (int i = 0; i < Q[type].size(); i++)
      if (!Add(Q[type][i].first.first, Q[type][i].first.second,
               Q[type][i].second)) {
        cout << "0\n";
        return 0;
      }
    for (int i = 1; i < MAX_N; i++) {
      if (!seg[i].size()) continue;
      sort(seg[i].begin(), seg[i].end());
      int tmp = seg[i][0].first, val = seg[i][0].second;
      for (int j = 1; j < seg[i].size(); j++) {
        if (!Add(tmp, seg[i][j].first, (val == seg[i][j].second ? 1 : 2))) {
          cout << "0\n";
          return 0;
        }
        tmp = seg[i][j].first;
        val = seg[i][j].second;
      }
    }
    refresh();
  }
  cout << _Pow(2, n - cnt) << "\n";
  return 0;
}
