#include <iostream>
#include <vector>
#include <algorithm>
// #include <ctime>

using namespace std;

typedef 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);
	ull ans;
//	clock_t wholetime = 0;
	// 都合上、0! = 0とする
	fact[0] = 0;
	fact[1] = 1;
	ull fs = 1;
	for (int i = 2; i < MAX_N + 1; i++){
		fs = (fs*i) % MOD;
		fact[i] = (fact[i-1] + fs) % MOD;
	}

	while (1){
		int N, R;
		cin >> N;
		if (N == 0) break;

		vector<int> word(N);
		for (int i = 0; i < N; i++) word[i] = i;
		word.push_back(0);
		ans = 0;
		cin >> R;

		vector<int> s(2*R+2, 0);
		s[2 * R + 1] = N;
		for (int i = 0; i < R; i++){
			cin >> s[i] >> s[i+R];
			s[i]--; s[i+R]--;

			s.push_back(s[i] + 1);
			s.push_back(s[i+R] + 1);

			// xor swap
			word[s[i]] ^= word[s[i+R]];
			word[s[i+R]] ^= word[s[i]];
			word[s[i]] ^= word[s[i+R]];
		}

//		clock_t st = clock();
		sort(s.begin(), s.end());
		s.erase(unique(s.begin(), s.end()), s.end());

		for (int i = 0, R = s.size() - 1; i < R; i++){

			ull tmp = fact[N - s[i] - 1] - fact[N - s[i+1] - 1];
			tmp = (tmp * word[s[i]]) % MOD;
			ans =(ans + tmp) % MOD;
//			cout << ans << ",";
			// 値を詰める
			int dif = s[i+1] - s[i];
			for (int j = i + 1; j < R; j++){
				word[s[j]] -= (word[s[j]] > word[s[i]] ? dif : 0);
			}
		}
//		clock_t ed = clock();
//		wholetime += (ed - st);
		cout << (ans + MOD) % MOD << endl;
	}

//	cout << (double)wholetime / CLOCKS_PER_SEC << endl;
	return 0;
}