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

mods :: Int
mods = 10 ^ (9 :: Int) + 7

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) = (min n m, max n m)
    print $ case y - x of
                0 -> modFact x ^ 2 * 2 `mod` mods
                1 -> modFact x ^ 2 * y `mod` mods
                _ -> 0
