#include <bits/stdc++.h>
using namespace std;
long long a[101], b[101], sgn[101], dp[71][71];
string s;
inline int read() {
  register int x = 0;
  register char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x;
}
bool charge(int t1, int t2, int l, int r, int k) {
  for (register int i = 1; i <= k; ++i)
    if (((a[i] == t1 && b[i] == t2) || (a[i] == t2 && b[i] == t1)) &&
        (sgn[i] == 0 || sgn[i] == 4))
      return false;
    else if ((a[i] == t1 || a[i] == t2) && b[i] >= l && b[i] <= r &&
             sgn[i] >= 2)
      return false;
    else if ((b[i] == t1 || b[i] == t2) && a[i] >= l && a[i] <= r &&
             sgn[i] <= 2)
      return false;
  return true;
}
int main() {
  register int n = read(), k = read();
  for (register int i = 1; i <= k; ++i) {
    cin >> a[i] >> s >> b[i];
    if (s[0] == '=')
      sgn[i] = 2;
    else if (s[0] == '<' && s[1] == '=')
      sgn[i] = 1;
    else if (s[0] == '<')
      sgn[i] = 0;
    else if (s[0] == '>' && s[1] == '=')
      sgn[i] = 3;
    else
      sgn[i] = 4;
  }
  for (register int i = 2; i <= (n << 1); i += 2)
    for (register int l = 1; l <= (n << 1) - i + 1; ++l) {
      register int r = l + i - 1;
      dp[l][r] = 0;
      if (i == 2) {
        if (charge(l, r, l + 1, r - 1, k)) dp[l][r] = 1;
      } else {
        if (charge(l, l + 1, l + 2, r, k)) dp[l][r] += dp[l + 2][r];
        if (charge(r - 1, r, l, r - 2, k)) dp[l][r] += dp[l][r - 2];
        if (charge(l, r, l + 1, r - 1, k)) dp[l][r] += dp[l + 1][r - 1];
      }
    }
  cout << dp[1][n << 1];
  return 0;
}
