#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 9;
const int N = 1005;
vector<pair<int, int> > p1, p2, p3, p4, p5;
int n, m;
long long f[100][100];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i < n * 2; i++) f[i][i + 1] = 1;
  for (int i = 1; i <= m; i++) {
    int x, y;
    char s[5];
    scanf("%d %s %d", &x, s, &y);
    if (s[0] == '>' && strlen(s) == 1)
      p1.push_back(make_pair(x, y)), f[x][y] = f[y][x] = 0;
    if (s[0] == '<' && strlen(s) == 1)
      p2.push_back(make_pair(x, y)), f[x][y] = f[y][x] = 0;
    if (s[0] == '=' && strlen(s) == 1) p3.push_back(make_pair(x, y));
    if (s[0] == '>' && strlen(s) == 2) p4.push_back(make_pair(x, y));
    if (s[0] == '<' && strlen(s) == 2) p5.push_back(make_pair(x, y));
  }
  auto ck = [&](int l1, int r1, int l2, int r2) {
    for (auto it : p1)
      if ((it.first == l1 || it.first == r1) && it.second >= l2 &&
          it.second <= r2)
        return false;
    for (auto it : p1)
      if ((it.first == l1 || it.first == r1) &&
          (it.second == l1 || it.second == r1))
        return false;
    for (auto it : p2)
      if (it.first >= l2 && it.first <= r2 &&
          (it.second == l1 || it.second == r1))
        return false;
    for (auto it : p2)
      if ((it.first == l1 || it.first == r1) &&
          (it.second == l1 || it.second == r1))
        return false;
    for (auto it : p3)
      if ((it.first == l1 || it.first == r1) && it.second >= l2 &&
          it.second <= r2)
        return false;
    for (auto it : p3)
      if (it.first >= l2 && it.first <= r2 &&
          (it.second == l1 || it.second == r1))
        return false;
    for (auto it : p4)
      if ((it.first == l1 || it.first == r1) && it.second >= l2 &&
          it.second <= r2)
        return false;
    for (auto it : p5)
      if (it.first >= l2 && it.first <= r2 &&
          (it.second == l1 || it.second == r1))
        return false;
    return true;
  };
  for (int len = 4; len <= 2 * n; len += 2) {
    for (int i = 1; i + len - 1 <= 2 * n; i++) {
      int ed = i + len - 1;
      if (ck(i, i + 1, i + 2, ed)) f[i][ed] += f[i + 2][ed];
      if (ck(ed - 1, ed, i, ed - 2)) f[i][ed] += f[i][ed - 2];
      if (ck(i, ed, i + 1, ed - 1)) f[i][ed] += f[i + 1][ed - 1];
    }
  }
  cout << f[1][2 * n];
}
