Go: // 九九を出すだけ
package main
import (
	"fmt"
	"os"
	"bufio"
)
var out = bufio.NewWriter(os.Stdout)

func main(){
	defer out.Flush()
	for i:=1; i<10; i++{
		for j:=1; j<10; j++{
			fmt.Fprintf(out, "%dx%d=%d\n", i, j, i*j)
		}
	}
}

C++: #include<iostream>
using namespace std;

int main() {
	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			cout << i << "x" << j << " = " << i*j << endl;
		}
	}
	return 0;
}

C++: aaaa

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <sstream>

using namespace std;

string expr(int x, int y) {
    stringstream ss;
    ss << x << "x" << y << "=" << x*y;
    return ss.str();
}

int main() {
    set<string> c;
    int n = 1e5;
    while (n--) {
        int x = rand() % 9 + 1;
        int y = rand() % 9 + 1;
        c.insert(expr(x, y));
    }
    for (set<string>::iterator it=c.begin(); it!=c.end(); ++it) {
        cout << *it << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
 
using namespace std;
 
int main()
{
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      printf("%dx%d=%d\n",i,j,i*j);
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	int i,j;
	for(int i=1; i<10; i++){
		for(int j=1; j<10; j++)
			cout << i << "x" << j << "=" << i*j << "\n" ;
	}
    return 0;
}

C++: #include <stdio.h>
int main(){
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            printf("%dx%d=%d\n",i,j,i*j);
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace::std;

int main() {
    for(int i=1;i<10;i++)
        for(int j=1;j<10;j++)
            cout << i << "x" << j << "=" << i*j << endl;
    return 0;
}

C++: #include <iostream>

int main(){
	
	//double loop
	//?????????????????§??????
	for(int i = 1; i <= 9; ++i){
		for(int j = 1; j <= 9; ++j){
			std::cout << i << "x" << j << "=" << i*j << std::endl;
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
for(int i = 1;i<10;i++)
for(int j = 1;j<10;j++)
cout << i << 'x' << j << '='<<i*j<<endl;
return 0;
}

C++: #include<stdio.h>
int a, b;int main(){for(a=1;a<=9;a++)for(b=1;b<=9;b++)printf("%dx%d=%d\n",a,b,a*b);return 0;}

C++: #include<stdio.h>

int main(void){
	int printf(1x1=1,1x2=2,..9x8=72,9x9=81)

		return 0;
}

C++: #include<iostream>
using namespace std;

int main(){

  for(int i=1;i<10;i++){
    for(int n=1;n<10;n++){
      cout << i << "x" << n << "=" << i*n << endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
using namespace std;

int main(){
    while(1)puts("poyo");
    return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair<int,string> P;

const static ll MOD = 1000000007;

class BinaryIndexedTree {
private:
  int* bit;
  int n;
public:
  BinaryIndexedTree(int _size){
    bit = new int[_size];
    n = _size;
    fill(bit,bit+_size,0);
  }
  int sum(int i){
    int s = 0;
    while(i > 0){
      s += bit[i];
      i -= i & -i;
    }
    return s;
  }
  
  void add(int i, int x){
    while(i <= n){
      bit[i] += x;
      i += i & -i;
    }
  }
};

int main(){
  int N,R;
  ll dp[100001];
  ll target[100001];

  while(~scanf("%d %d",&N,&R)){
    if(N == 0) break;

    memset(dp,0,sizeof(dp));
    dp[0] = 1;

    for(int i=1;i<=N;i++){
      target[i] = i;
      // 4
      // v v v v
      //  1 2 3
      dp[i] = dp[i-1] * i % MOD;
    }
    for(int r = 0; r< R;r++){
      int from_idx;
      int to_idx;
      scanf("%d %d",&from_idx,&to_idx);
      swap(target[from_idx],target[to_idx]);
    }

    ll res = 0;
    BinaryIndexedTree BIT(100001);
    for(int i=N,j=0;i>=1;i--,j++){
      res += ((dp[j] % MOD) * (BIT.sum(target[i] - 1) % MOD) % MOD);
      res %= MOD;
      BIT.add(target[i],1);
    }
    printf("%lld\n",res);
  }
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Here your code !
    char i,j;
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            printf("%dx%d=%d\n",i,j,(i*j));
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	for(int i =1 ; i < 10 ;i++){
		cout << i <<"x"<<i<<"="<<i*i<<endl;
	}
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	for(int i = 1;i<=9;i++)
	{
		for(int j=1;j<=0;j++)
		{
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
    return 0;
}

C++: #include<cstdio>

int main()
{
    for(int i=1;i<=9;i++) for(int j=1;j<=9;j++) printf("%dx%d=%d\n",i,j,i*j);
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
for (int i = 1; i <= 9; i++){
for (int j = 1; j <= 9; j++){
printf("%d x %d = %d\r\n", i, j, i * j);
}
}

return (0);
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

int main(void)
{
	int ans;
	for(int i = 1; i <= 9; i++){
		for(int j = 1; j <= 9; j++){
			ans = i * j;
			printf("%dx%d=%d\n", i, j, ans);
		}
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
    int a = 1, b = 1;
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            cout << a << "x" << b << "=" << a * b << endl;
            b++;
        }
        b = 1;
        a++;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int main() {
#ifdef _DEBUG
	printf( "debug\n" );
#endif
	for ( int i = 1; i < 10; i++ ) {
		for ( int j = 1; j < 10; j++ ) {
			printf( "%dx%d=%d\n", i, j, i * j );
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
for(int i = 1; i < 10; i++)
for(int j = 1; j < 10; j++)
cout << i << "x" << j << "=" << i*j << endl;
return 0;
}

C++: #include<stdio.h>
char a, b;int main(){for(a=1;a<=9;a++)for(b=1;b<=9;b++)printf("%dx%d=%d\n",a,b,a*b);return 0;}

C++: #include<stdio.h>
int main(void){
	int a, b, c;
	for(a=1;a<10;a++){
		for(b=1;b<10;b++){
		c = a * b;
		printf("%dx%d=%d\n", a, b, c);
		}
	}
	return 0;
}

C++: #include<iostream>

static void printQq( void )
{
	int i, j;

	for ( i = 1; i <= 9; i++ ) {
		for ( j = 1; j <= 9; j++ ) {
			std::cout << i << "x" << j << "=" << (i * j) << '\n';
		}
	}
}

int main()
{
	printQq();

	return 0;
}