import Control.Monad
import Data.List

main=do
    [m,n]<-map read.words<$>getLine::IO[Int]
    print $ case abs (m-n) of
        0 -> ((((pm n) * (pm m))`mod` 1000000007) * 2) `mod` 1000000007
        1 -> ((pm n) * (pm m)) `mod` 1000000007
        _ -> 0

pm n = foldl1 (\a x -> (a*x)`mod`1000000007) [1..n] 