#include <bits/stdc++.h>
using namespace std;
int n, m;
long long dp[80][80];
struct node {
  int x, y, c;
} a[110];
bool check(int aa, int bb, int l, int r) {
  for (int i = 1; i <= m; i++) {
    int x = a[i].x, y = a[i].y, c = a[i].c;
    if ((x == aa && y == bb) || (x == bb && y == aa)) {
      if (c == 1 || c == 5) return false;
    } else if (x == aa || x == bb) {
      if (c == 1 && (y < l || y > r))
        return false;
      else if (c == 2 && (y < l || y > r) && y != aa && y != bb)
        return false;
      else if (c == 3 && y != aa && y != bb)
        return false;
      else if (c == 4 && y >= l && y <= r)
        return false;
      else if (c == 5 && ((y >= l && y <= r) || y == aa || y == bb))
        return false;
    } else if (y == aa || y == bb) {
      if (c == 1 && ((x >= l && x <= r) || x == aa || x == bb))
        return false;
      else if (c == 2 && x >= l && x <= r)
        return false;
      else if (c == 3 && x != aa && x != bb)
        return false;
      else if (c == 4 && (x < l || x > r) && x != aa && x != bb)
        return false;
      else if (c == 5 && (x < l || x > r))
        return false;
    }
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    char s[10];
    int c;
    scanf("%d%s%d", &a[i].x, s + 1, &a[i].y);
    if (s[1] == '<' && s[2] == '=')
      c = 2;
    else if (s[1] == '>' && s[2] == '=')
      c = 4;
    else if (s[1] == '<')
      c = 1;
    else if (s[1] == '=')
      c = 3;
    else if (s[1] == '>')
      c = 5;
    a[i].c = c;
  }
  for (int l = 2; l <= 2 * n; l++) {
    for (int i = 1; i <= 2 * n - l + 1; i++) {
      int j = i + l - 1;
      if (l == 2) {
        if (check(i, j, i + 1, j - 1)) dp[i][j] = 1;
      } else {
        if (check(i, i + 1, i + 2, j)) dp[i][j] += dp[i + 2][j];
        if (check(j - 1, j, i, j - 2)) dp[i][j] += dp[i][j - 2];
        if (check(i, j, i + 1, j - 1)) dp[i][j] += dp[i + 1][j - 1];
      }
    }
  }
  printf("%lld", dp[1][2 * n]);
  return 0;
}
