import std.algorithm;
import std.math;
import std.stdio;

immutable int MOD = 1_000_000_007;
immutable int limit = 100_005;

int [] f;

static this ()
{
	f = new int [limit];
	f[0] = 1;
	foreach (i; 1..limit)
	{
		f[i] = (f[i - 1] * 1L * i) % MOD;
	}
}

int solve (int a, int b)
{
	if (abs (a - b) > 1)
	{
		return 0;
	}
	if (a > b)
	{
		swap (a, b);
	}
	return (f[a] * (1L + (a == b)) * f[b]) % MOD;
}

void main ()
{
	int n, m;
	while (readf (" %s %s", &n, &m) > 0)
	{
		writeln (solve (n, m));
	}
}
