#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
long long dp[maxn][maxn];
struct limit {
  int type;
  int x;
  limit(int type, int x) {
    this->type = type;
    this->x = x;
  }
};
vector<limit> a[maxn];
bool ok(int L, int R, int dl, int dr) {
  if (dl == 2) {
    for (int i = 0; i < a[L + 1].size(); i++) {
      limit thi = a[L + 1][i];
      if (thi.type == 1 && thi.x != L + 2) return false;
      if (thi.type == 2 && (L + 1 <= thi.x && thi.x < R)) return false;
      if (thi.type == 3 && (thi.x <= L + 2 || R <= thi.x)) return false;
      if (thi.type == 4 && (L + 2 < thi.x && thi.x < R)) return false;
      if (thi.type == 5 && (thi.x < L + 1 || R <= thi.x)) return false;
    }
    for (int i = 0; i < a[L + 2].size(); i++) {
      limit thi = a[L + 2][i];
      if (thi.type == 1 && thi.x != L + 1) return false;
      if (thi.type == 2 && (L + 1 <= thi.x && thi.x < R)) return false;
      if (thi.type == 3 && (thi.x <= L + 2 || R <= thi.x)) return false;
      if (thi.type == 4 && (L + 2 < thi.x && thi.x < R)) return false;
      if (thi.type == 5 && (thi.x < L + 1 || R <= thi.x)) return false;
    }
    return true;
  }
  if (dr == 2) {
    for (int i = 0; i < a[R - 1].size(); i++) {
      limit thi = a[R - 1][i];
      if (thi.type == 1 && thi.x != R - 2) return false;
      if (thi.type == 2 && (L < thi.x && thi.x <= R - 1)) return false;
      if (thi.type == 3 && (thi.x <= L || thi.x >= R - 2)) return false;
      if (thi.type == 4 && (L < thi.x && thi.x < R - 2)) return false;
      if (thi.type == 5 && (thi.x <= L || thi.x > R - 1)) return false;
    }
    for (int i = 0; i < a[R - 2].size(); i++) {
      limit thi = a[R - 2][i];
      if (thi.type == 1 && thi.x != R - 1) return false;
      if (thi.type == 2 && (L < thi.x && thi.x <= R - 1)) return false;
      if (thi.type == 3 && (thi.x <= L || thi.x >= R - 2)) return false;
      if (thi.type == 4 && (L < thi.x && thi.x < R - 2)) return false;
      if (thi.type == 5 && (thi.x <= L || thi.x > R - 1)) return false;
    }
    return true;
  }
  if (dl == 1 && dr == 1) {
    for (int i = 0; i < a[L + 1].size(); i++) {
      limit thi = a[L + 1][i];
      if (thi.type == 1 && thi.x != R - 1) return false;
      if (thi.type == 2 && (L + 1 <= thi.x && thi.x <= R - 1)) return false;
      if (thi.type == 3 && (thi.x <= L + 1 || R - 1 <= thi.x)) return false;
      if (thi.type == 4 && (L + 1 < thi.x && thi.x < R - 1)) return false;
      if (thi.type == 5 && (thi.x < L + 1 || R - 1 < thi.x)) return false;
    }
    for (int i = 0; i < a[R - 1].size(); i++) {
      limit thi = a[R - 1][i];
      if (thi.type == 1 && thi.x != L + 1) return false;
      if (thi.type == 2 && (L + 1 <= thi.x && thi.x <= R - 1)) return false;
      if (thi.type == 3 && (thi.x <= L + 1 || R - 1 <= thi.x)) return false;
      if (thi.type == 4 && (L + 1 < thi.x && thi.x < R - 1)) return false;
      if (thi.type == 5 && (thi.x < L + 1 || R - 1 < thi.x)) return false;
    }
    return true;
  }
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; i++) {
    int x, y;
    char s[5];
    scanf("%d%s%d", &x, s, &y);
    if (s[0] == '=' && x != y) a[y].push_back(limit(1, x));
    if (s[0] == '<') {
      if (s[1] == '=')
        a[y].push_back(limit(4, x));
      else
        a[y].push_back(limit(2, x));
    }
    if (s[0] == '>') {
      if (s[1] == '=')
        a[y].push_back(limit(5, x));
      else
        a[y].push_back(limit(3, x));
    }
  }
  dp[0][2 * n + 1] = 1;
  for (int i = 1; i <= n; i++)
    for (int L = 0; L + (n - i + 1) * 2 <= 2 * n; L++) {
      int R = L + (n - i + 1) * 2 + 1;
      if (ok(L, R, 2, 0)) dp[L + 2][R] += dp[L][R];
      if (i < n && ok(L, R, 0, 2)) dp[L][R - 2] += dp[L][R];
      if (i < n && ok(L, R, 1, 1)) dp[L + 1][R - 1] += dp[L][R];
    }
  long long ans = 0;
  for (int L = 0; L <= 2 * n; L++) ans += dp[L][L + 1];
  printf("%I64d\n", ans);
  return 0;
}
