#include <bits/stdc++.h>
using namespace std;
vector<pair<int, string> > data[105];
long long dp[105][105];
long long solve(int l, int r) {
  if (l > r) return 1ll;
  if (dp[l][r] != -1) return dp[l][r];
  long long ans = 0;
  int i, is_it = 1;
  for (int j = 0; j < 2; j++)
    for (i = 0; i < data[l + j].size(); i++) {
      int to = data[l + j][i].first;
      string second = data[l + j][i].second;
      if (second == "=")
        if (!(to == l || to == l + 1)) is_it = 0;
      if (second == ">")
        if (!(to < l || to > r)) is_it = 0;
      if (second == ">=")
        if (!(to < l || to > r || to == l || to == l + 1)) is_it = 0;
      if (second == "<")
        if (!(to > l + 1 && to <= r)) is_it = 0;
      if (second == "<=")
        if (!((to > l + 1 && to <= r) || (to == l || to == l + 1))) is_it = 0;
    }
  if (is_it) ans += solve(l + 2, r);
  is_it = 1;
  for (int j = 0; j <= r - l; j += (r - l))
    for (i = 0; i < data[l + j].size(); i++) {
      int to = data[l + j][i].first;
      string second = data[l + j][i].second;
      if (second == "=")
        if (!(to == l || to == r)) is_it = 0;
      if (second == ">")
        if (!(to < l || to > r)) is_it = 0;
      if (second == ">=")
        if (!(to < l || to > r || to == l || to == r)) is_it = 0;
      if (second == "<")
        if (!(to > l && to < r)) is_it = 0;
      if (second == "<=")
        if (!((to > l && to < r) || (to == l || to == r))) is_it = 0;
    }
  if (is_it) ans += solve(l + 1, r - 1);
  is_it = 1;
  for (int j = 0; j < 2; j++)
    for (i = 0; i < data[r - j].size(); i++) {
      int to = data[r - j][i].first;
      string second = data[r - j][i].second;
      if (second == "=")
        if (!(to == r || to == r - 1)) is_it = 0;
      if (second == ">")
        if (!(to < l || to > r)) is_it = 0;
      if (second == ">=")
        if (!(to < l || to > r || to == r || to == r - 1)) is_it = 0;
      if (second == "<")
        if (!(to >= l && to < r - 1)) is_it = 0;
      if (second == "<=")
        if (!((to >= l && to < r - 1) || (to == r || to == r - 1))) is_it = 0;
    }
  if (is_it) ans += solve(l, r - 2);
  if (l + 1 == r) ans /= 3;
  return dp[l][r] = ans;
}
int main() {
  int n, k, i;
  cin >> n >> k;
  for (i = 0; i < k; i++) {
    int x, y;
    string second;
    cin >> x >> second >> y;
    x--;
    y--;
    data[x].push_back({y, second});
    if (second == "<=")
      second = ">=";
    else if (second == ">=")
      second = "<=";
    else if (second == ">")
      second = "<";
    else if (second == "<")
      second = ">";
    data[y].push_back({x, second});
  }
  for (i = 0; i < 105; i++)
    for (int j = 0; j < 105; j++) dp[i][j] = -1;
  cout << solve(0, 2 * n - 1) << endl;
  return 0;
}
