#include <bits/stdc++.h>
using namespace std;
const int MAX = 103;
vector<pair<int, string>> b[MAX];
long long dp[MAX][MAX];
bool check(int l, int r, int i, int j) {
  for (auto [pos, c] : b[i]) {
    if (c == "=" && pos != j) return false;
    if (c == ">=" && pos != j && (l <= pos && pos <= r)) return false;
    if (c == ">" && (l <= pos && pos <= r)) return false;
  }
  for (auto [pos, c] : b[j]) {
    if (c == "=" && pos != i) return false;
    if (c == ">=" && pos != i && (l <= pos && pos <= r)) return false;
    if (c == ">" && (l <= pos && pos <= r)) return false;
  }
  return true;
}
long long solve(int l, int r) {
  long long &ans = dp[l][r];
  if (ans != -1) {
    return ans;
  }
  ans = 0;
  if (l + 1 == r) {
    if (check(l, r, l + 1, r - 1)) ans = 1;
    return ans;
  }
  if (check(l, r, l, l + 1)) {
    ans += solve(l + 2, r);
  }
  if (check(l, r, l, r)) {
    ans += solve(l + 1, r - 1);
  }
  if (check(l, r, r - 1, r)) {
    ans += solve(l, r - 2);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  n *= 2;
  bool ok = 1;
  for (int i = 0; i < m; ++i) {
    int x, y;
    string c;
    cin >> x >> c >> y;
    if (x == y && (c == "<" || c == ">")) ok = 0;
    if (x == y) continue;
    if (c == "=") {
      b[x].emplace_back(y, c);
      b[y].emplace_back(x, c);
    } else if (c == "<") {
      b[y].emplace_back(x, ">");
    } else if (c == "<=") {
      b[y].emplace_back(x, ">=");
    } else if (c == ">") {
      b[x].emplace_back(y, ">");
    } else if (c == ">=") {
      b[x].emplace_back(y, ">=");
    }
  }
  if (!ok) {
    cout << "0\n";
    return 0;
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(1, n) << '\n';
  return 0;
}
