import static java.util.Arrays.fill;

import java.io.*;
import java.util.*;

/**
 * Slow bruteforce solution. Works in O(n * 3 ^ (2n)) time.
 * 
 * @author niyaz.nigmatullin
 * 
 */
public class operators_nn_exp {

	static final int MOD = 1000000007;
	static final String PROBLEM_ID;
	static {
		String s = new Throwable().getStackTrace()[0].getClassName();
		PROBLEM_ID = s.substring(0, s.indexOf('_'));
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(new File(PROBLEM_ID + ".in"));
		PrintWriter out = new PrintWriter(PROBLEM_ID + ".out");
		int n = sc.nextInt();
		int m = sc.nextInt();
		boolean[][] canPut = new boolean[n][];
		for (int i = 0; i < n; i++) {
			canPut[i] = new boolean[2 * i + 1];
			fill(canPut[i], true);
		}
		for (int i = 0; i < m; i++) {
			int x = n - sc.nextInt();
			int y = sc.nextInt() - 1;
			canPut[x][y] = false;
		}
		out.println(solveBrute(n, canPut));
		out.close();
	}

	static int solveBrute(int n, boolean[][] canPut) {
		dict = new HashMap<State, Integer>();
		return go(0, 0, n, canPut);
	}

	static class State {
		int line;
		int mask;

		public State(int line, int mask) {
			this.line = line;
			this.mask = mask;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + line;
			result = prime * result + mask;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			State other = (State) obj;
			if (line != other.line)
				return false;
			if (mask != other.mask)
				return false;
			return true;
		}

	}

	static Map<State, Integer> dict;

	static int go(int line, int mask, int n, boolean[][] canPut) {
		if (line == n) {
			return 1;
		}
		State state = new State(line, mask);
		if (dict.containsKey(state)) {
			return dict.get(state);
		}
		int count = line * 2 + 1;
		int ret = 0;
		int canPutMask = 0;
		for (int i = 0; i < count; i++) {
			if (canPut[line][i]) {
				canPutMask |= 1 << i;
			}
		}
		for (int newMask = 0; newMask < 1 << count; newMask++) {
			if ((canPutMask & newMask) != newMask) {
				continue;
			}
			if ((newMask & mask) != 0) {
				continue;
			}
			int z = newMask | mask;
			int nextMask = 0;
			for (int i = 0; i < count; i++) {
				if (((z >> i) & 1) == 1) {
					nextMask |= 7 << i;
				}
			}
			ret = add(ret, go(line + 1, nextMask, n, canPut));
		}
		dict.put(state, ret);
		return ret;
	}

	static int add(int a, int b) {
		a += b;
		if (a >= MOD) {
			a -= MOD;
		}
		return a;
	}
}
