#include <bits/stdc++.h>
using namespace std;
const int N = 225, mod = (int)1e9 + 7;
int n, k;
long long f[N][N];
long long ans;
struct data {
  int p;
  int q;
  string sign;
} d[N];
bool check(int l, int r, int L, int R) {
  for (int i = 1; i <= k; ++i) {
    if (d[i].p == L && d[i].q == R && d[i].sign != "=" && d[i].sign != ">=" &&
        d[i].sign != "<=")
      return 0;
    else if (d[i].p == R && d[i].q == L && d[i].sign != "=" &&
             d[i].sign != ">=" && d[i].sign != "<=")
      return 0;
    else if (d[i].p == L || d[i].p == R) {
      if (d[i].q >= l && d[i].q <= r) continue;
      if (d[i].sign != ">" && d[i].sign != ">=") return 0;
    } else if (d[i].q == L || d[i].q == R) {
      if (d[i].p >= l && d[i].p <= r) continue;
      if (d[i].sign != "<" && d[i].sign != "<=") return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= k; i++) cin >> d[i].p >> d[i].sign >> d[i].q;
  f[1][2 * n] = 1;
  for (int l = 2 * n; l >= 2; l -= 2)
    for (int i = 1; i + l - 1 <= 2 * n; ++i) {
      int j = i + l - 1;
      if (f[i][j] == 0) continue;
      f[i + 1][j - 1] += check(i, j, i, j) * f[i][j];
      if (i == j - 1) continue;
      f[i + 2][j] += check(i, j, i, i + 1) * f[i][j];
      f[i][j - 2] += check(i, j, j - 1, j) * f[i][j];
    }
  for (int i = 0; i <= 2 * n - 1; i++) ans += f[i + 1][i];
  cout << ans << endl;
}
