#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
struct requirement {
  int x, y;
  char sig[10];
  requirement() { memset(sig, 0, sizeof(sig)); }
  long long hash() {
    return 0LL + x + (1LL << 8) * y + (1LL << 16) * sig[0] +
           (1LL << 17) * sig[1];
  }
};
const int maxn = 110;
int n, k;
vector<requirement> req;
int a[maxn];
map<pair<pair<int, int>, vector<long long> >, long long> mp;
long long cal(int n, vector<requirement> req);
long long go1(int n, vector<requirement> req) {
  memset(a, 0x3f, sizeof(a));
  a[0] = a[1] = 1;
  bool flag = true;
  for (int i = 0; i < int((req).size()); i++) {
    int u = req[i].x;
    int v = req[i].y;
    if (u < 2 || v < 2) {
      if (req[i].sig[0] == '<' && req[i].sig[1] != '=' && a[u] >= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] != '=' && a[u] <= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '=' && a[u] != a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '<' && req[i].sig[1] == '=' && a[u] > a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] == '=' && a[u] < a[v]) {
        flag = false;
        break;
      }
    }
  }
  if (flag) {
    vector<requirement> tmp;
    for (int i = 0; i < int((req).size()); i++) {
      int u = req[i].x;
      int v = req[i].y;
      if (u >= 2 && v >= 2) {
        requirement elm;
        elm.x = u - 2;
        elm.y = v - 2;
        elm.sig[0] = req[i].sig[0];
        elm.sig[1] = req[i].sig[1];
        tmp.push_back(elm);
      }
    }
    return cal(n - 1, tmp);
  }
  return 0;
}
long long go2(int n, vector<requirement> req) {
  memset(a, 0x3f, sizeof(a));
  a[0] = a[2 * n - 1] = 1;
  bool flag = true;
  for (int i = 0; i < int((req).size()); i++) {
    int u = req[i].x;
    int v = req[i].y;
    if (!u || !v || u == 2 * n - 1 || v == 2 * n - 1) {
      if (req[i].sig[0] == '<' && req[i].sig[1] != '=' && a[u] >= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] != '=' && a[u] <= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '=' && a[u] != a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '<' && req[i].sig[1] == '=' && a[u] > a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] == '=' && a[u] < a[v]) {
        flag = false;
        break;
      }
    }
  }
  if (flag) {
    vector<requirement> tmp;
    for (int i = 0; i < int((req).size()); i++) {
      int u = req[i].x;
      int v = req[i].y;
      if (u > 0 && v > 0 && u < 2 * n - 1 && v < 2 * n - 1) {
        requirement elm;
        elm.x = u - 1;
        elm.y = v - 1;
        elm.sig[0] = req[i].sig[0];
        elm.sig[1] = req[i].sig[1];
        tmp.push_back(elm);
      }
    }
    return cal(n - 1, tmp);
  }
  return 0;
}
long long go3(int n, vector<requirement> req) {
  memset(a, 0x3f, sizeof(a));
  a[2 * n - 2] = a[2 * n - 1] = 1;
  bool flag = true;
  for (int i = 0; i < int((req).size()); i++) {
    int u = req[i].x;
    int v = req[i].y;
    if (u >= 2 * n - 2 || v >= 2 * n - 2) {
      if (req[i].sig[0] == '<' && req[i].sig[1] != '=' && a[u] >= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] != '=' && a[u] <= a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '=' && a[u] != a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '<' && req[i].sig[1] == '=' && a[u] > a[v]) {
        flag = false;
        break;
      }
      if (req[i].sig[0] == '>' && req[i].sig[1] == '=' && a[u] < a[v]) {
        flag = false;
        break;
      }
    }
  }
  if (flag) {
    vector<requirement> tmp;
    for (int i = 0; i < int((req).size()); i++) {
      int u = req[i].x;
      int v = req[i].y;
      if (u < 2 * n - 2 && v < 2 * n - 2) {
        requirement elm;
        elm.x = u;
        elm.y = v;
        elm.sig[0] = req[i].sig[0];
        elm.sig[1] = req[i].sig[1];
        tmp.push_back(elm);
      }
    }
    return cal(n - 1, tmp);
  }
  return 0;
}
long long cal(int n, vector<requirement> req) {
  vector<long long> v;
  for (int i = 0; i < int((req).size()); i++) v.push_back(req[i].hash());
  if (mp.count(make_pair(make_pair(n, k), v)))
    return mp[make_pair(make_pair(n, k), v)];
  if (n == 1) {
    for (int i = 0; i < int((req).size()); i++)
      if (req[i].sig[0] != '=' && req[i].sig[1] != '=') return 0;
    return 1;
  }
  return mp[make_pair(make_pair(n, k), v)] =
             go1(n, req) + go2(n, req) + go3(n, req);
}
void solve() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k; i++) {
    requirement tmp;
    scanf("%d%s%d", &tmp.x, tmp.sig, &tmp.y);
    tmp.x--;
    tmp.y--;
    req.push_back(tmp);
  }
  cout << cal(n, req);
}
int main() {
  solve();
  return 0;
}
