import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

mods :: Int
mods = 1000000007

modFact :: Int -> Int
modFact 0 = 1
modFact n = n * modFact (n - 1) `mod` mods

main :: IO ()
main = do
    [n, m] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    let (x, y, z) = (max n m, min n m, abs (n - m))
    print $ case z of
                0 -> modFact y ^ (2 :: Int) * 2 `mod` mods
                1 -> modFact y ^ (2 :: Int) * x `mod` mods
                _ -> 0
