#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
long long dp[100][100];
int e[100][110], c[100][110];
int check(int l, int r, int x, int y) {
  for (int i = 1; i <= e[x][0]; i++) {
    int cc = c[x][i];
    int ee = e[x][i];
    if (cc == 1)
      if (ee < l || ee > r) return 0;
    if (cc == 2)
      if (ee >= l && ee <= r && ee != x && ee != y) return 0;
    if (cc == 3)
      if (ee < l || ee > r || ee == x || ee == y) return 0;
    if (cc == 4)
      if (ee >= l && ee <= r) return 0;
    if (cc == 5)
      if (ee != x && ee != y) return 0;
  }
  return 1;
}
int chk(int l, int r, int x, int y) {
  return check(l, r, x, y) && check(l, r, y, x);
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = (1); i <= (m); i++) {
    int a, b;
    string s;
    cin >> a >> s >> b;
    e[a][++e[a][0]] = b;
    if (s == "<=")
      c[a][e[a][0]] = 1;
    else if (s == ">=")
      c[a][e[a][0]] = 2;
    else if (s == "<")
      c[a][e[a][0]] = 3;
    else if (s == ">")
      c[a][e[a][0]] = 4;
    else if (s == "=")
      c[a][e[a][0]] = 5;
  }
  for (int i = (1); i <= (2 * n - 1); i++)
    dp[i][i + 1] = chk(i, i + 1, i, i + 1);
  for (int len = 4; len <= 2 * n; len += 2) {
    for (int l = 1; l + len - 1 <= 2 * n; l++) {
      int r = l + len - 1;
      if (chk(l, r, l, r)) dp[l][r] += dp[l + 1][r - 1];
      if (chk(l, r, l, l + 1)) dp[l][r] += dp[l + 2][r];
      if (chk(l, r, r - 1, r)) dp[l][r] += dp[l][r - 2];
    }
  }
  cout << dp[1][2 * n] << endl;
  return 0;
}
