#include <bits/stdc++.h>
using namespace std;
const int mx = 75;
long long dp[mx][mx][mx];
vector<pair<int, int> > q[mx];
bool jud(int l1, int r1, int l, int r) {
  int a, b;
  for (int i = 0; i < q[l1].size(); i++) {
    a = q[l1][i].first;
    b = q[l1][i].second;
    if (b == 3 && a != r1 && a != l1) return false;
    if (b == 4 && a < r && a > l && a != r1 && a != l1) return false;
    if (b == 5 && a < r && a > l) return false;
  }
  for (int i = 0; i < q[r1].size(); i++) {
    a = q[r1][i].first;
    b = q[r1][i].second;
    if (b == 3 && a != l1 && a != r1) return false;
    if (b == 4 && a < r && a > l && a != l1 && a != r1) return false;
    if (b == 5 && a < r && a > l) return false;
  }
  return true;
}
long long dfs(int l, int r, int num) {
  if (l + 1 == r) {
    return 1;
  }
  if (dp[l][r][num] >= 0) return dp[l][r][num];
  long long ans = 0L;
  if (jud(l + 1, l + 2, l, r)) ans += dfs(l + 2, r, num + 1);
  if ((l + 2) != (r - 1) && jud(l + 1, r - 1, l, r))
    ans += dfs(l + 1, r - 1, num + 1);
  if ((l + 2) != (r - 1) && jud(r - 1, r - 2, l, r))
    ans += dfs(l, r - 2, num + 1);
  return dp[l][r][num] = ans;
}
int main() {
  int n, k, x, y, tmp;
  string str;
  memset(dp, -1, sizeof(dp));
  scanf("%d%d", &n, &k);
  while (k--) {
    cin >> x >> str >> y;
    if (str == "<") tmp = 1;
    if (str == "<=") tmp = 2;
    if (str == "=") tmp = 3;
    if (str == ">=") tmp = 4;
    if (str == ">") tmp = 5;
    if (tmp >= 3)
      q[x].push_back(make_pair(y, tmp));
    else
      q[y].push_back(make_pair(x, 6 - tmp));
  }
  printf("%I64d\n", dfs(0, n * 2 + 1, 0));
  return 0;
}
