#include <bits/stdc++.h>
using namespace std;
const int MAX = 80;
long long dp[MAX][MAX], n, k;
string c[MAX][MAX];
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int a, b;
    string ch;
    cin >> a >> ch >> b, a--, b--;
    if (ch == ">") c[a][b] = ">", c[b][a] = "<";
    if (ch == "<") c[a][b] = "<", c[b][a] = ">";
    if (ch == ">=") c[a][b] = ">=", c[b][a] = "<=";
    if (ch == "<=") c[a][b] = "<=", c[b][a] = ">=";
    if (ch == "=") c[a][b] = c[b][a] = "=";
  }
  for (int i = 2; i <= 2 * n; i += 2) {
    for (int j = 0; j < 2 * n; j++)
      if (j + i <= 2 * n) {
        int l = j, r = j + i - 1;
        if (i == 2) {
          if (c[l][r] == ">" || c[l][r] == "<")
            dp[l][r] = 0;
          else
            dp[l][r] = 1;
          continue;
        }
        bool f1 = true, f2 = true, f3 = true;
        for (int i = l + 2; i <= r; i++) {
          if (c[l][i] == ">" || c[l][i] == ">=" || c[l][i] == "=") f1 = false;
          if (c[l + 1][i] == ">" || c[l + 1][i] == ">=" || c[l + 1][i] == "=")
            f1 = false;
        }
        for (int i = l + 1; i <= r - 1; i++) {
          if (c[l][i] == ">" || c[l][i] == ">=" || c[l][i] == "=") f2 = false;
          if (c[r][i] == ">" || c[r][i] == ">=" || c[r][i] == "=") f2 = false;
        }
        for (int i = l; i <= r - 2; i++) {
          if (c[r][i] == ">" || c[r][i] == ">=" || c[r][i] == "=") f3 = false;
          if (c[r - 1][i] == ">" || c[r - 1][i] == ">=" || c[r - 1][i] == "=")
            f3 = false;
        }
        if (f1 && c[l][l + 1] != ">" && c[l][l + 1] != "<")
          dp[l][r] += dp[l + 2][r];
        if (f2 && c[l][r] != ">" && c[l][r] != "<")
          dp[l][r] += dp[l + 1][r - 1];
        if (f3 && c[r][r - 1] != ">" && c[r][r - 1] != "<")
          dp[l][r] += dp[l][r - 2];
      }
  }
  cout << dp[0][2 * n - 1];
}
