#include <bits/stdc++.h>
int n, k;
long long dp[80][80], ans;
int b[80][80];
int ch(int fl, int fr, int a, int c) {
  for (int i = fl; i <= fr; i++)
    if (b[a][i] == 3 || b[c][i] == 3 || b[a][i] < 0 || b[c][i] < 0) return 0;
  return 1;
}
int cc(int bl, int br, int a, int c) {
  for (int i = 1; i <= bl; i++)
    if (b[a][i] > 0 || b[c][i] > 0) return 0;
  for (int i = br; i <= 2 * n; i++)
    if (b[a][i] > 0 || b[c][i] > 0) return 0;
  return 1;
}
int check(int i, int j) { return b[i][j] != -2 && b[i][j] != 2; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; i++) {
    int l, r, f;
    char s[5];
    memset(s, 0, sizeof s);
    scanf("%d%s%d", &l, s, &r);
    if (s[0] == '=') {
      b[l][r] = 3;
      b[r][l] = 3;
    } else {
      if (s[0] == '<') {
        f = 2;
        if (s[1]) f--;
      }
      if (s[0] == '>') {
        f = -2;
        if (s[1]) f++;
      }
      b[l][r] = f;
      b[r][l] = -f;
    }
  }
  dp[1][2 * n] = 1;
  for (int t = 1; t <= n; t++)
    for (int i = 1; i <= 2 * t - 1; i++) {
      int j = 2 * n - 2 * t + i + 1;
      if (dp[i][j]) {
        if (j == i + 1) {
          if (check(i, j)) {
            ans += dp[i][j];
          }
        } else {
          if (ch(i + 1, j - 1, i, j) && cc(i - 1, j + 1, i, j) && check(i, j))
            dp[i + 1][j - 1] += dp[i][j];
          if (ch(i + 2, j, i, i + 1) && cc(i - 1, j + 1, i, i + 1) &&
              check(i, i + 1))
            dp[i + 2][j] += dp[i][j];
          if (ch(i, j - 2, j - 1, j) && cc(i - 1, j + 1, j - 1, j) &&
              check(j - 1, j))
            dp[i][j - 2] += dp[i][j];
        }
      }
    }
  printf("%lld", ans);
  return 0;
}
