#include <iostream>
#include <algorithm>

#define INF 1000000007
#define MAX 100000

using namespace std;

int main(){
  int n,m; cin >> n >> m;
  long long f[MAX+1];
  f[0]=1;
  int mm=max(n,m);
  for(int i=1;i<=mm;i++){
    f[i]=(f[i-1]*i) % INF;
  }
  if(m-n+1==0 || m-n+1==2){
    cout << (f[n]*f[m]) %INF << endl;
  }else if(m-n+1 == 1){
    cout << (2*f[n]*f[m]) %INF << endl;
  }else{
    cout << 0 << endl;
  }
}