#include <bits/stdc++.h>
using namespace std;
const int maxn = 75, maxm = 105;
int N, K;
pair<string, pair<int, int> > rules[maxm];
long long dp[maxn][maxn][maxn][maxn];
inline string flip(string second) {
  if (second == "=") return second;
  if (second == "<") return ">";
  if (second == ">") return "<";
  if (second == "<=") return ">=";
  return "<=";
}
inline bool same_side(int first, int second, int a, int b) {
  if (b == first) return a <= b;
  return a >= b;
}
inline bool valid(int first, int second, int l1, int l2, int f_lst) {
  second = 2 * N - second + 1;
  int want = f_lst ? first : second;
  bool ans = true;
  for (int i = 1; i <= K; i++) {
    if (rules[i].second.second == rules[i].second.first) continue;
    if (rules[i].second.first != want && rules[i].second.second != want)
      continue;
    string op =
        (rules[i].second.first == want ? rules[i].first : flip(rules[i].first));
    bool swapped = false;
    if (rules[i].second.second == want) {
      swap(rules[i].second.first, rules[i].second.second);
      swapped = true;
    }
    if (!(rules[i].second.second > first && rules[i].second.second < second)) {
      if (same_side(first, second, rules[i].second.second, want)) {
        if (op == "<") ans = false;
        if (op == "=" || op == "<=") {
          if (abs(want - rules[i].second.second) > 1) ans = false;
          if ((first + 2 * N - second + 1) % 2 == 0)
            ans &= (l2 != l1);
          else
            ans = false;
        } else if (op == ">") {
          if (abs(want - rules[i].second.second) == 1 && l1 != l2 &&
              (first + 2 * N - second + 1) % 2 == 0)
            ans = false;
        }
      } else {
        if (op == "<") ans = false;
        int oth = (want == first ? second : first);
        if (op == "=" || op == "<=") {
          if (rules[i].second.second != oth) ans = false;
          ans &= (l1 == l2);
        } else if (op == ">") {
          if (rules[i].second.second == oth && l1 == l2 &&
              (first + 2 * N - second + 1) % 2 == 0)
            ans = false;
        }
      }
    }
    if (swapped) swap(rules[i].second.first, rules[i].second.second);
  }
  return ans;
}
long long solve(int idx, int first, int l1, int l2) {
  if (dp[idx][first][l1][l2] != -1) return dp[idx][first][l1][l2];
  long long res = 0;
  if (idx == N - 1) {
    if (valid(first + 1, 2 * idx - first, N, l2, 1) &&
        valid(first + 1, 2 * idx - first + 1, N, N, 0)) {
      return dp[idx][first][l1][l2] = 1;
    }
    return dp[idx][first][l1][l2] = 0;
  }
  if (valid(first + 1, 2 * idx - first, idx + 1, l2, 1) &&
      valid(first + 1, 2 * idx - first + 1, idx + 1, idx + 1, 0))
    res += solve(idx + 1, first + 1, idx + 1, idx + 1);
  if (valid(first + 1, 2 * idx - first, idx + 1, l2, 1) &&
      valid(first + 2, 2 * idx - first, idx + 1, l2, 1))
    res += solve(idx + 1, first + 2, idx + 1, l2);
  if (valid(first, 2 * idx - first + 1, l1, idx + 1, 0) &&
      valid(first, 2 * idx - first + 2, l1, idx + 1, 0))
    res += solve(idx + 1, first, l1, idx + 1);
  return dp[idx][first][l1][l2] = res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 1; i <= K; i++) {
    cin >> rules[i].second.first >> rules[i].first >> rules[i].second.second;
    if (rules[i].second.first == rules[i].second.second) {
      if (rules[i].first != "=" && rules[i].first != "<=" &&
          rules[i].first != ">=") {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0, 0, 0) << '\n';
}
