#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
const ull MOD = 1000000007;
const int MAX_N = 100000;
ull fact[MAX_N + 1];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<ull> ans;
	fact[0] = 0;
	fact[1] = 1;
	for (int i = 2; i < MAX_N + 1; i++) fact[i] = (fact[i - 1] * i) % MOD;
	while (1){
		int N, R;
		ull num = 0;
		cin >> N;
		if (N == 0) break;
		ans.push_back(0);
		vector<int> word(N);
		for (int i = 0; i < N; i++) word[i] = i;
		word.push_back(0);
		cin >> R;
		vector<int> s(2*R+1, 0);
		for (int i = 0; i < R; i++){
			cin >> s[i] >> s[i+R];
			s[i]--; s[i+R]--;
			word[s[i]] ^= word[s[i+R]];
			word[s[i+R]] ^= word[s[i]];
			word[s[i]] ^= word[s[i+R]];
		}
		sort(s.begin(), s.end());
		s.erase(unique(s.begin(), s.end()), s.end());
		s.push_back(N);
		for (int i = 0, R = s.size() - 1; i < R; i++){
			ull tmp = fact[N - s[i] - 1], tmp2 = 0;
			tmp *= word[s[i]];
			tmp = tmp % MOD;
			for (int j = i; j < R; j++){
				word[s[j]] -= (word[s[j]] > word[s[i]] ? 1 : 0);
				if (s[j] + 1 != s[j + 1]){
					word[s[j] + 1] -= (word[s[j] + 1] > word[s[i]] ? 1 : 0);
				}
			}
			for (int j = s[i] + 1; j < s[i + 1]; j++){
				tmp2 += fact[N - j - 1];
				tmp2 = tmp2 % MOD;
			}
			for (int j = i + 1; j < R; j++){
				word[s[j]] -= (word[s[j]] > word[s[i] + 1] ? s[i+1] - s[i] - 1 : 0);
				if (s[j] + 1 != s[j + 1]){
					word[s[j] + 1] -= (word[s[j] + 1] > word[s[i] + 1] ? s[i+1] - s[i] - 1 : 0);
				}
			}
			tmp2 *= word[s[i] + 1];
			tmp += tmp2;
			tmp += *(ans.end() - 1);
			*(ans.end() - 1) = tmp % MOD;
		}
	}
	for (int i = 0, l = ans.size(); i < l; i++){
		cout << ans[i] << endl;
	}
	return 0;
}