Problem:
Score : 900 points

Problem Statement

There are 2N points evenly spaced on the circumference of a circle.
These points are numbered 1 to 2N in clockwise order, starting from some of them.

Snuke will divide these points into N pairs, then for each pair, he will draw a line segment connecting the two points.
After the line segments are drawn, two points are connected when one can reach from one of those points to the other by traveling only on the line segments.
The number of the connected parts here is the number of the connected components in the graph with 2N vertices, corresponding to the 2N points, where every pair of vertices corresponding to two connected points is connected with an edge.

Snuke has already decided K of the pairs, and the i-th of them is a pair of Point A_i and Point B_i.

He is thinking of trying all possible ways to make the remaining N-K pairs and counting the number of the connected parts for each of those ways.
Find the sum of those numbers of the connected parts.
As the answer can be extremely large, compute the sum modulo 10^9+7.

Constraints

1 \leq N \leq 300

0 \leq K \leq N

1 \leq A_i,B_i \leq 2N

A_1,\ A_2,\ ...\ A_K,\ B_1,\ B_2,\ ...\ B_K are all distinct.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 B_1
A_2 B_2
:
A_K B_K

Output

Print the sum of the numbers of the connected parts for all possible ways to make the remaining N-K pairs.

Sample Input 1

2 0

Sample Output 1

5

There are three ways to draw line segments, as shown below, and the number of the connected parts for these ways are 2, 2 and 1, respectively.
Thus, the answer is 2+2+1=5.

Sample Input 2

4 2
5 2
6 1

Sample Output 2

6

Sample Input 3

20 10
10 18
11 17
14 7
4 6
30 28
19 24
29 22
25 32
38 34
36 39

Sample Output 3

27087418

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Time Limit Exceeded)

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputStream input;
		OutputStream output;
		try {
			input = new FileInputStream("input.txt");
			output = new FileOutputStream("output.txt");
		} catch (FileNotFoundException e) {
			input = System.in;
			output = System.out;
		}
		Kattio io = new Kattio(input, output);
		(new Solve(io)).main();
		io.close();

		if (input instanceof FileInputStream)
			try {
				input.close();
			} catch (IOException e) {

			}
		if (output instanceof FileOutputStream)
			try {
				output.close();
			} catch (IOException e) {

			}
	}
}

class Solve {
	
	static final long mod = (long) 1e9+7;
	
	Kattio io;
	
	int n,k;
	int[] a,b;
	int[] f;
	BigInteger[][] dp;
	
	BigInteger[] memoWaysToPair;
	
	Solve(Kattio io) {
		this.io = io;
	}

	BigInteger waysToPair(int x)
	{
		if (!memoWaysToPair[x].equals(new BigInteger("-1"))) 
			return memoWaysToPair[x];
		
		if (x%2==1) 
			memoWaysToPair[x]=BigInteger.ZERO;
		else
		if (x==0)
			memoWaysToPair[x]=BigInteger.ONE;
		else
			memoWaysToPair[x]=waysToPair(x-2).multiply(new BigInteger(Integer.toString(x-1)));
		
		//io.println(x+" "+memoWaysToPair[x]);
		return memoWaysToPair[x];
	}
	
	int paired(int x,int y)
	{
		//io.println(x+" "+y+" "+((f[y]-f[x-1])>(y-x+1)));
		return f[y]-f[x-1];
	}
	
	boolean inside(int a,int x,int y)
	{
		return (x<=a && a<=y);
	}
	
	BigInteger caldp(int x,int y)
	{
		if (!dp[x][y].equals(new BigInteger("-1"))) return dp[x][y];
		
		int notPairedinXY = (y-x+1)-paired(x,y);
		
		//io.println(notPairedOutSideXY<0);
		
		for (int i=1; i<=k; i++)
		{
			boolean p1 = inside(a[i],x,y);
			boolean p2 = inside(b[i],x,y);
			if (p1!=p2)
			{
				dp[x][y]=BigInteger.ZERO;
				return dp[x][y];
			}
		}
		
		dp[x][y]=waysToPair(notPairedinXY);
		
		//io.println(x+" "+y+" "+dp[x][y]);
		
		for (int z=x+1; z<y; z++)
		{
			int notPairedinZY = (y-(z+1)+1)-paired(z+1,y);
			dp[x][y]=dp[x][y].subtract(caldp(x,z).multiply(waysToPair(notPairedinZY)));
		}
		
		//io.println(x+" "+y+" "+dp[x][y]);
		
		return dp[x][y];
		
	}
	void main() {
		//io.println(mod);
		n=io.getInt();
		n*=2;
		k=io.getInt();
		a = new int[k+1];
		b = new int[k+1];
		f = new int[n+1];
		
		Arrays.fill(f, 0);
		
		for (int i=1; i<=k; i++)
		{
			a[i] = io.getInt();
			b[i] = io.getInt();
			f[a[i]]=1;
			f[b[i]]=1;
		}
		
		for (int i=1; i<=n; i++)
			f[i]+=f[i-1];
		
		dp = new BigInteger[n+1][n+1];
		
		for (int i=0; i<=n; i++)
			Arrays.fill(dp[i], new BigInteger("-1"));
		
		memoWaysToPair = new BigInteger[n+1];
		Arrays.fill(memoWaysToPair, new BigInteger("-1"));
		
		BigInteger res = BigInteger.ZERO;
		for (int x=1; x<=n; x++)
			for (int y=x; y<=n; y++)
			{
				int notPairedOutSideXY = (n-(y-x+1))-(f[n]-paired(x,y));
				res=res.add(caldp(x,y).multiply(waysToPair(notPairedOutSideXY)));
			}
		
		io.print(res.mod(new BigInteger(Long.toString(mod))));
	}
}

class Kattio extends PrintWriter {
	public Kattio(InputStream i) {
		super(new BufferedOutputStream(System.out));
		r = new BufferedReader(new InputStreamReader(i));
	}

	public Kattio(InputStream i, OutputStream o) {
		super(new BufferedOutputStream(o));
		r = new BufferedReader(new InputStreamReader(i));
	}

	public boolean hasMoreTokens() {
		return peekToken() != null;
	}

	public int getInt() {
		return Integer.parseInt(nextToken());
	}

	public double getDouble() {
		return Double.parseDouble(nextToken());
	}

	public long getLong() {
		return Long.parseLong(nextToken());
	}

	public String getWord() {
		return nextToken();
	}

	private BufferedReader r;
	private String line;
	private StringTokenizer st;
	private String token;

	private String peekToken() {
		if (token == null)
			try {
				while (st == null || !st.hasMoreTokens()) {
					line = r.readLine();
					if (line == null)
						return null;
					st = new StringTokenizer(line);
				}
				token = st.nextToken();
			} catch (IOException e) {
			}
		return token;
	}

	private String nextToken() {
		String ans = peekToken();
		token = null;
		return ans;
	}
}