#include <bits/stdc++.h>
using namespace std;
int n, k;
int id[105];
int A[105];
int B[105];
long long dp[77][77];
bool check(int left, int right, int pos1, int pos2) {
  for (int i = 0; i < k; i++) {
    if (A[i] == pos1) {
      if (B[i] == pos2 && id[i] == 1) return false;
      if (B[i] <= left || B[i] >= right) {
        return false;
      }
    } else if (A[i] == pos2) {
      if (B[i] == pos1 && id[i] == 1) return false;
      if (B[i] <= left || B[i] >= right) {
        return false;
      }
    } else if (B[i] == pos1) {
      if (A[i] == pos2 && id[i] == 1) return false;
      if (A[i] <= left || A[i] >= right) {
        if (id[i] == 0) return false;
      }
    } else if (B[i] == pos2) {
      if (A[i] == pos1 && id[i] == 1) return false;
      if (A[i] <= left || A[i] >= right) {
        if (id[i] == 0) return false;
      }
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    string s;
    cin >> A[i] >> s >> B[i];
    if (s == "<") {
      id[i] = 1;
    } else if (s == ">") {
      id[i] = 1;
      swap(A[i], B[i]);
    } else if (s == "=") {
      id[i] = 0;
    } else if (s == "<=") {
      id[i] = 2;
    } else {
      id[i] = 2;
      swap(A[i], B[i]);
    }
  }
  dp[0][2 * n + 1] = 1;
  for (int i = 0; i <= 2 * n - 2; i++) {
    for (int j = 2 * n + 1; j >= i + 3; j--) {
      long long x = dp[i][j];
      if (x == 0) continue;
      if (j - i > 3 && check(i, j, i + 1, i + 2)) dp[i + 2][j] += x;
      if (check(i, j, i + 1, j - 1)) dp[i + 1][j - 1] += x;
      if (j - i > 3 && check(i, j, j - 2, j - 1)) dp[i][j - 2] += x;
    }
  }
  long long answer = 0;
  for (int i = 1; i < 2 * n; i++) {
    answer += dp[i][i + 1];
  }
  cout << answer << endl;
}
