solver::Int -> Int -> Int
solver n m = if not((n==m)||(n==m+1)||(n+1==m)) then 0 else
                      if n==m then red_prd [(red_fuc n),(red_fuc n),2]
                              else red_prd [(red_fuc m),(red_fuc n)]

red_fuc::Int -> Int
red_fuc 1 = 1
red_fuc n = let n_ = mod n 1000000007  in mod (red_fuc (n-1) * n_)  1000000007

red_prd::[Int] -> Int
red_prd []=1
red_prd (x:xs)= let x_ = mod x 1000000007 in mod ((red_prd xs) * x_) 1000000007

main::IO()
main=do
  d<-getLine
  let n:m:[]=map read (words d)
  print (solver n m)
