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 Rust (1.15.1) (judge verdict: Time Limit Exceeded)

// ${url}
//
#![allow(unused_imports)]
use std::io::*;
use std::io::Write;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

// ===

const MOD: i64 = 1e9 as i64 + 7;
const NONE: usize = 10000000;


fn in_range(i: usize, j: usize, k: usize) -> bool {
    if i <= j {
        return i <= k && k <= j;
    } else {
        return i <= k || k <= j;
    }
}

fn main() {
    input! {
        n: usize, k: usize,
        edges: [(usize1, usize1); k]
    };

    let mut other = vec![NONE; 4*n];
    for (u, v) in edges {
        other[u] = v;
        other[u+2*n] = v;
        other[v] = u;
        other[v+2*n] = u;
    }

    let counter_range = |i: usize, j: usize|
        if (j+1)%(2*n) == i {
            (2*n+1, 2*n+1)
        } else {
            ((j+1)%(2*n), (i+2*n-1)%(2*n))
        };

    let mut any_range = dvec!(0; 2*n+10, 2*n+10);
    for i in 0..2*n {
        for len in 0..2*n {
            let j = (i+len)%(2*n);
            let mut free_count = 0;
            let mut valid = len%2 == 1;
            for k in i..i+len+1 {
                if other[k] == NONE {
                    free_count += 1;
                } else if !in_range(i, j, other[k]) {
                    valid = false;
                }
            }
            if free_count % 2 == 1 {
                valid = false;
            }
            if valid {
                let mut mul = 1;
                while free_count >= 1 {
                    mul *= free_count-1;
                    mul %= MOD;
                    free_count -= 2;
                }
                any_range[i][j] = mul;
            }
        }
    }

    let mut dp = dvec!(0; 2*n+10, 2*n+10);
    for len in 1..2*n {
        for i in 0..2*n {
            let j = (i+len)%(2*n);
            let mut ways = any_range[i][j];
            for k in i..i+len {
                let pi = i;
                let pj = k%(2*n);
                let qi = (pj+1)%(2*n);
                let qj = j;
                ways += MOD - dp[pi][pj] * any_range[qi][qj] % MOD;
                ways %= MOD;
            }
            // ways *= any_range[oi][oj];
            // ways %= MOD;
            dp[i][j] = ways;
        }
    }
    any_range[2*n+1][2*n+1] = 1;

    // debug!(dp);

    let mut total = 0;
    for i in 0..2*n {
        for j in i..2*n {
            let (oi, oj) = counter_range(i, j);
            total += dp[i][j] * any_range[oi][oj] % MOD;
            // debug!(i,j,oi,oj,dp[i][j], any_range[oi][oj]);
            total %= MOD;
        }
    }

    println!("{}", total);
}