#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXPAIRS = 35;
const int MAXREQ = 100;
int npair, nreq;
int ra[MAXREQ], rb[MAXREQ];
char rc[MAXREQ][3];
bool caneq(char *s) { return s[0] == '=' || s[1] == '='; }
bool cangt(char *s) { return s[0] == '>'; }
bool canlt(char *s) { return s[0] == '<'; }
bool check(int s, int t, int p, int q) {
  for (int i = (0); i < (nreq); ++i) {
    if ((ra[i] == p || ra[i] == q) && (rb[i] == p || rb[i] == q))
      if (caneq(rc[i]))
        continue;
      else
        return false;
    if ((ra[i] == p || ra[i] == q))
      if (s <= rb[i] && rb[i] <= t)
        if (canlt(rc[i]))
          continue;
        else
          return false;
      else if (cangt(rc[i]))
        continue;
      else
        return false;
    if ((rb[i] == p || rb[i] == q))
      if (s <= ra[i] && ra[i] <= t)
        if (cangt(rc[i]))
          continue;
        else
          return false;
      else if (canlt(rc[i]))
        continue;
      else
        return false;
  }
  return true;
}
long long mem[MAXPAIRS + 1][2 * MAXPAIRS];
long long go(int n, int off) {
  if (n == 0) return 1;
  long long &ret = mem[n][off];
  if (ret == -1) {
    ret = 0;
    if (check(off, off + 2 * n - 1, off, off + 1)) ret += go(n - 1, off + 2);
    if (n != 1 && check(off, off + 2 * n - 1, off, off + 2 * n - 1))
      ret += go(n - 1, off + 1);
    if (n != 1 && check(off, off + 2 * n - 1, off + 2 * n - 2, off + 2 * n - 1))
      ret += go(n - 1, off);
  }
  return ret;
}
void run() {
  scanf("%d%d", &npair, &nreq);
  for (int i = (0); i < (nreq); ++i)
    scanf("%d%s%d", &ra[i], &rc[i], &rb[i]), --ra[i], --rb[i];
  memset(mem, -1, sizeof(mem));
  cout << go(npair, 0) << endl;
}
int main() {
  run();
  return 0;
}
