#include <bits/stdc++.h>
using namespace std;
const int N = 72;
long long n, k, _n, dp[N][N];
bool e[N][N], l[N][N];
bool check(int st, int en, int x, int y) {
  while (st < en) {
    if (!l[x][st] || !l[y][st]) return false;
    st++;
  }
  return true & e[x][y];
}
int main() {
  cin >> n >> k;
  _n = n * 2;
  fill(*e, *end(e), 1);
  fill(*l, *end(l), 1);
  while (k--) {
    int x, y;
    string s;
    cin >> x >> s >> y;
    x--, y--;
    if (s == "=") l[x][y] = l[y][x] = 0;
    if (s == ">=") l[x][y] = 0;
    if (s == "<=") l[y][x] = 0;
    if (s == ">") l[x][y] = e[x][y] = e[y][x] = 0;
    if (s == "<") l[y][x] = e[x][y] = e[y][x] = 0;
  }
  for (int len = 1; len <= n; len++)
    for (int l = 0, r = 2 * len; r <= _n; l++, r++) {
      if (len == 1) {
        dp[l][r] = e[l][r - 1];
        continue;
      }
      if (check(l + 1, r - 1, l, r - 1)) dp[l][r] += dp[l + 1][r - 1];
      if (check(l, r - 2, r - 1, r - 2)) dp[l][r] += dp[l][r - 2];
      if (check(l + 2, r, l + 1, l)) dp[l][r] += dp[l + 2][r];
    }
  cout << dp[0][_n] << endl;
}
