#include <bits/stdc++.h>
using namespace std;
const int M = 1000;
const int Q = 1e9 + 7;
int k;
long long dp[M][M];
int x[M], y[M];
string s[M];
int ch_2(int i, int t) {
  for (int j = 0; j < k; j++) {
    if (((x[j] == i && y[j] == t) || (x[j] == t && y[j] == i)) &&
        (s[j] == "<" || s[j] == ">"))
      return 0;
  }
  return 1;
}
int ch_1(int i, int l, int r) {
  for (int j = 0; j < k; j++) {
    if (x[j] == i && l <= y[j] && y[j] <= r && !(s[j] == "<" || s[j] == "<="))
      return 0;
    if (y[j] == i && l <= x[j] && x[j] <= r && !(s[j] == ">" || s[j] == ">="))
      return 0;
  }
  return 1;
}
int main() {
  srand(time(NULL));
  int n;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k; i++) {
    cin >> x[i] >> s[i] >> y[i];
    x[i]--, y[i]--;
  }
  for (int i = 0; i <= 2 * n - 2; i++) {
    dp[n][i] = ch_2(i, i + 1);
  }
  for (int i = n - 1; i >= 1; i--)
    for (int j = 0; j + 2 * (n - i + 1) <= 2 * n; j++) {
      int f = j + 2 * (n - i + 1);
      int ok[3];
      ok[0] =
          ch_2(j, j + 1) * ch_1(j, j + 2, f - 1) * ch_1(j + 1, j + 2, f - 1);
      ok[1] =
          ch_2(f - 2, f - 1) * ch_1(f - 1, j, f - 3) * ch_1(f - 2, j, f - 3);
      ok[2] =
          ch_2(j, f - 1) * ch_1(j, j + 1, f - 2) * ch_1(f - 1, j + 1, f - 2);
      dp[i][j] = ok[0] * dp[i + 1][j + 2] + ok[1] * dp[i + 1][j] +
                 ok[2] * dp[i + 1][j + 1];
    }
  cout << dp[1][0] << endl;
  return 0;
}
