Problem: King of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital.

The mausoleum will be constructed from 2n blocks, each of them has the shape of a cuboid. Each block has the bottom base of a 1 × 1 meter square. Among the blocks, exactly two of them have the height of one meter, exactly two have the height of two meters, ..., exactly two have the height of n meters.

The blocks are arranged in a row without spacing one after the other. Of course, not every arrangement of blocks has the form of a mausoleum. In order to make the given arrangement in the form of the mausoleum, it is necessary that when you pass along the mausoleum, from one end to the other, the heights of the blocks first were non-decreasing (i.e., increasing or remained the same), and then — non-increasing (decrease or remained unchanged). It is possible that any of these two areas will be omitted. For example, the following sequences of block height meet this requirement:

  * [1, 2, 2, 3, 4, 4, 3, 1]; 
  * [1, 1]; 
  * [2, 2, 1, 1]; 
  * [1, 2, 3, 3, 2, 1]. 



Suddenly, k more requirements appeared. Each of the requirements has the form: "h[xi] signi h[yi]", where h[t] is the height of the t-th block, and a signi is one of the five possible signs: '=' (equals), '<' (less than), '>' (more than), '<=' (less than or equals), '>=' (more than or equals). Thus, each of the k additional requirements is given by a pair of indexes xi, yi (1 ≤ xi, yi ≤ 2n) and sign signi.

Find the number of possible ways to rearrange the blocks so that both the requirement about the shape of the mausoleum (see paragraph 3) and the k additional requirements were met.

Input

The first line of the input contains integers n and k (1 ≤ n ≤ 35, 0 ≤ k ≤ 100) — the number of pairs of blocks and the number of additional requirements.

Next k lines contain listed additional requirements, one per line in the format "xi signi yi" (1 ≤ xi, yi ≤ 2n), and the sign is on of the list of the five possible signs.

Output

Print the sought number of ways.

Examples

Input

3 0


Output

9


Input

3 1
2 &gt; 3


Output

1


Input

4 1
3 = 6


Output

3

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskF {
        long[][] dp;
        int n;
        int k;
        TaskF.Constraint[] constraints;

        public void solve(int testNumber, Reader in, PrintWriter out) {
            n = in.ni();
            k = in.ni();
            dp = new long[2 * n][2 * n];
            for (long[] a : dp) {
                Arrays.fill(a, Long.MIN_VALUE);
            }
            constraints = new TaskF.Constraint[k];
            for (int i = 0; i < k; i++) {
                int x, y;
                String sign;
                x = in.ni() - 1;
                sign = in.next();
                y = in.ni() - 1;
                if (x > y) {
                    switch (sign) {
                        case "<":
                            sign = ">";
                            break;
                        case ">":
                            sign = "<";
                            break;
                        case "<=":
                            sign = ">=";
                            break;
                        case ">=":
                            sign = "<=";
                            break;
                    }
                }
                constraints[i] = new TaskF.Constraint(Math.min(x, y), Math.max(y, x), sign);
                if (x == y && (sign.equals("<") || sign.equals(">"))) {
                    out.println(0);
                    return;
                }
            }
            dfs(0, 2 * n - 1);
            out.println(dp[0][2 * n - 1]);
        }

        public void dfs(int l, int r) {
            if (dp[l][r] != Long.MIN_VALUE) {
                return;
            }
            if (l + 1 == r) {
                if (!check(l, r, l, r)) {
                    dp[l][r] = 0;
                } else {
                    dp[l][r] = 1;
                }
                return;
            }
            long total = 0;
            if (check(l, r, l, l + 1)) {
                dfs(l + 2, r);
                total += dp[l + 2][r];
            }
            if (check(l, r, r - 1, r)) {
                dfs(l, r - 2);
                total += dp[l][r - 2];
            }
            if (check(l, r, l, r)) {
                dfs(l + 1, r - 1);
                total += dp[l + 1][r - 1];
            }
            dp[l][r] = total;
        }

        public boolean check(int l, int r, int x, int y) {
            for (TaskF.Constraint constraint : constraints) {
                if (constraint.x < l || constraint.x > r || constraint.y > r || constraint.y < l) {
                    continue;
                }
                if (constraint.x == x && constraint.y == y) {
                    if (constraint.sign.equals(">") || constraint.sign.equals("<")) {
                        return false;
                    }
                } else {
                    String sign = constraint.sign;
                    if (constraint.x == constraint.y) {
                        continue;
                    }
                    if (constraint.x == x || constraint.x == y) {
                        if (sign.equals(">") || sign.equals("=") || sign.equals(">=")) {
                            return false;
                        }
                    }
                    if (constraint.y == x || constraint.y == y) {
                        if (sign.equals("<") || sign.equals("=") || sign.equals("<=")) {
                            return false;
                        }
                    }
                }
            }
            return true;
        }

        class Constraint extends PairInt {
            public String sign;

            public Constraint(int x, int y, String sign) {
                super(x, y);
                this.sign = sign;
            }

            public String toString() {
                return x + " " + y + " " + sign;
            }

        }

    }

    static class PairInt {
        public int x;
        public int y;

        public PairInt(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return x + " " + y;
        }

        public PairInt clone() {
            return new PairInt(x, y);
        }

    }

    static class Reader {
        private BufferedReader in;
        private StringTokenizer st = new StringTokenizer("");
        private String delim = " ";

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(delim);
        }

        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}