#include <bits/stdc++.h>
using namespace std;
struct query {
  long s;
  long x, y;
};
query q[100];
long nq, n;
long check(query q, long aa, long a, long b, long bb) {
  long r = 0;
  long s = q.s;
  long x = q.x, y = q.y;
  if (x == y) {
    if ((s == 2) || (s == 1) || (s == 3))
      return 1;
    else
      return 0;
  }
  if ((a + 1 != b) || (aa + 3 == bb)) {
    if (s == 0) {
      if (((x == a) && (y > b)) || ((x > a) && (y == b)) || (x == b))
        r = 1;
      else
        r = 0;
    }
    if (s == 1) {
      if (((x == a) && (y >= b)) || ((x >= a) && (y == b)) || (x == b))
        r = 1;
      else
        r = 0;
    }
    if (s == 3) {
      if (((x == a) && (y <= b)) || ((x <= a) && (y == b)) || (y == a))
        r = 1;
      else
        r = 0;
    }
    if (s == 4) {
      if (((x == a) && (y < b)) || ((x < a) && (y == b)) || (y == a))
        r = 1;
      else
        r = 0;
    }
  } else if ((x == a) && (y == b)) {
    if ((s == 2) || (s == 1) || (s == 3))
      return 1;
    else
      return 0;
  } else {
    if (s == 0) {
      if ((((x == a) || (x == b)) && (y >= bb)) ||
          ((x > aa) && ((y == a) || (y == b))))
        r = 1;
      else
        r = 0;
    }
    if (s == 1) {
      if ((((x == a) || (x == b)) && (y >= bb)) ||
          ((x > aa) && ((y == a) || (y == b))))
        r = 1;
      else
        r = 0;
    }
    if (s == 3) {
      if ((((x == a) || (x == b)) && (y < bb)) ||
          ((x <= aa) && ((y == a) || (y == b))))
        r = 1;
      else
        r = 0;
    }
    if (s == 4) {
      if ((((x == a) || (x == b)) && (y < bb)) ||
          ((x <= aa) && ((y == a) || (y == b))))
        r = 1;
      else
        r = 0;
    }
  }
  if ((s == 2) || (s == 1) || (s == 3)) {
    if ((x == a) && (y == b)) r = 1;
  }
  return r;
}
long checkx(long aa, long a, long b, long bb) {
  long ok = 1;
  if ((b > 2 * n) || (a <= 0))
    ok = 0;
  else {
    for (long i = 0; i < nq; ++i) {
      if ((q[i].x == a) || (q[i].x == b) || (q[i].y == a) || (q[i].y == b))
        ok = ok & check(q[i], aa, a, b, bb);
    }
  }
  return ok;
}
int main() {
  long i, j, k, a, b, sp;
  string s;
  long long dp[36][71];
  memset(dp, 0, sizeof dp);
  bool ok = true;
  cin >> n >> nq;
  for (i = 0; i < nq; ++i) {
    cin >> a >> s >> b;
    if (s == ">") sp = 0;
    if (s == ">=") sp = 1;
    if (s == "=") sp = 2;
    if (s == "<=") sp = 3;
    if (s == "<") sp = 4;
    if (a > b) {
      q[i].s = 4 - sp;
      q[i].x = b;
      q[i].y = a;
    } else {
      q[i].s = sp;
      q[i].x = a;
      q[i].y = b;
    }
  }
  if (checkx(0, 1, 2, 2 * n + 1))
    dp[1][2] = 1;
  else
    dp[1][2] = 0;
  if (checkx(0, 1, 2 * n, 2 * n + 1))
    dp[1][1] = 1;
  else
    dp[1][1] = 0;
  if (checkx(0, 2 * n - 1, 2 * n, 2 * n + 1))
    dp[1][0] = 1;
  else
    dp[1][0] = 0;
  for (i = 1; i < n - 1; ++i) {
    for (j = 0; j <= 2 * i; ++j) {
      if (checkx(j, j + 1, j + 2, 2 * n + 1 - (2 * i - j)))
        dp[i + 1][j + 2] += dp[i][j];
      if (checkx(j, j + 1, 2 * n - (2 * i - j), 2 * n + 1 - (2 * i - j)))
        dp[i + 1][j + 1] += dp[i][j];
      if (checkx(j, 2 * n - 1 - (2 * i - j), 2 * n - (2 * i - j),
                 2 * n + 1 - (2 * i - j)))
        dp[i + 1][j] += dp[i][j];
    }
  }
  long long sum = 0;
  if (n == 1) {
    if (checkx(0, 1, 2, 3))
      sum = 1;
    else
      sum = 0;
  } else {
    for (j = 0; j <= 2 * n - 2; ++j) {
      if (checkx(j, j + 1, j + 2, j + 3)) sum += dp[n - 1][j];
    }
  }
  cout << sum << endl;
  return 0;
}
