#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INF_LL = 4e18;
const double pi = acos(-1.0);
template <class T>
T& smin(T& a, const T& b) {
  if (a > b) a = b;
  return a;
}
template <class T>
T& smax(T& a, const T& b) {
  if (a < b) a = b;
  return a;
}
template <class T>
T sqr(const T& a) {
  return a * a;
}
template <typename Iterator>
void print(const char* fmt, Iterator begin, Iterator end,
           const char* separator = " ", const char* closing = "\n") {
  for (Iterator it = begin; it != end;
       printf(fmt, *it), printf("%s", ++it == end ? closing : separator))
    ;
}
const int N = 35 * 2;
int n, k;
vector<pair<string, int>> o[N];
long long d[N][N];
long long f(int l, int r);
long long h(int a, int b, int l, int r) {
  int le = l, re = r;
  if (a == l)
    ++l;
  else
    --r;
  if (b == l)
    ++l;
  else
    --r;
  int v[2] = {a, b};
  for (int i(0), _b(2); i < _b; ++i)
    for (auto& p : o[v[i]]) {
      if (p.first == "=" && p.second != a && p.second != b) return 0;
      if (p.first == "<" && (p.second < l || p.second > r)) return 0;
      if (p.first == "<=" && (p.second < le || p.second > re)) return 0;
      if (p.first == ">" && p.second >= le && p.second <= re) return 0;
      if (p.first == ">=" && p.second >= l && p.second <= r) return 0;
    }
  return f(l, r);
}
long long f(int l, int r) {
  if (l == r + 1) return 1;
  long long& res = d[l][r];
  if (res != -1) return res;
  res = h(l, l + 1, l, r);
  if (l + 1 < r) {
    res += h(l, r, l, r);
    res += h(r - 1, r, l, r);
  }
  return res;
}
int main() {
  cin.tie(NULL);
  scanf("%d%d", &n, &k);
  for (int i(0), _b(k); i < _b; ++i) {
    int a, b;
    char s[3];
    scanf("%d%s%d", &a, s, &b);
    --a;
    --b;
    o[a].emplace_back(s, b);
    if (s[0] != '=') s[0] = s[0] == '<' ? '>' : '<';
    o[b].emplace_back(s, a);
  }
  memset(d, -1, sizeof d);
  cout << f(0, 2 * n - 1) << endl;
  return 0;
}
