import qualified Data.Vector as V
main=print.solve.map read.words=<<getLine
solve[n,m]=max(2-abs(n-m))0*fact V.! n*fact V.! m`mod`mo
  where fact=V.generate(max n m+1)$ \i->if i<3 then i else fact V.!(i-1)*i`mod`mo
mo=10^9+7