#include <bits/stdc++.h>
using namespace std;
int n, K, x[110], y[110], sign[110];
char s[10];
long long f[75][75];
vector<int> v[75];
inline long long dfs(int l, int r) {
  if (f[l][r] != -1) return f[l][r];
  if (r == l + 1) {
    for (auto &p : v[l]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != l + 1) return f[l][r] = 0;
      }
      if (sign[p] == 2) {
        if (y[p] == l || y[p] == l + 1) return f[l][r] = 0;
      }
    }
    for (auto &p : v[l + 1]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != l + 1) return f[l][r] = 0;
      }
      if (sign[p] == 2) {
        if (y[p] == l || y[p] == l + 1) return f[l][r] = 0;
      }
    }
    return f[l][r] = 1;
  }
  f[l][r] = 0;
  bool flag;
  {
    flag = 1;
    for (auto &p : v[l]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != l + 1) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] > l + 1 && y[p] <= r) flag = 0;
      }
    }
    for (auto &p : v[l + 1]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != l + 1) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] > l + 1 && y[p] <= r) flag = 0;
      }
    }
    if (flag) f[l][r] += dfs(l + 2, r);
  }
  {
    flag = 1;
    for (auto &p : v[l]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != r) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] > l && y[p] < r) flag = 0;
      }
    }
    for (auto &p : v[r]) {
      if (sign[p] == 1) {
        if (y[p] != l && y[p] != r) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] > l && y[p] < r) flag = 0;
      }
    }
    if (flag) f[l][r] += dfs(l + 1, r - 1);
  }
  {
    flag = 1;
    for (auto &p : v[r]) {
      if (sign[p] == 1) {
        if (y[p] != r && y[p] != r - 1) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] >= l && y[p] < r - 1) flag = 0;
      }
    }
    for (auto &p : v[r - 1]) {
      if (sign[p] == 1) {
        if (y[p] != r && y[p] != r - 1) flag = 0;
      } else if (sign[p] == 2) {
        if (y[p] >= l && y[p] <= r) flag = 0;
      } else {
        if (y[p] >= l && y[p] < r - 1) flag = 0;
      }
    }
    if (flag) f[l][r] += dfs(l, r - 2);
  }
  return f[l][r];
}
int main() {
  memset(f, 255, sizeof(f));
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= K; i++) {
    scanf("%d%s%d", &x[i], s, &y[i]);
    int l = strlen(s);
    if (l == 1) {
      if (s[0] == '=')
        sign[i] = 1;
      else if (s[0] == '>')
        sign[i] = 2;
      else
        sign[i] = 2, swap(x[i], y[i]);
    } else {
      if (s[0] == '>')
        sign[i] = 3;
      else
        sign[i] = 3, swap(x[i], y[i]);
    }
    v[x[i]].push_back(i);
  }
  printf("%lld\n", dfs(1, 2 * n));
  return 0;
}
