integer N,M
read*,N,M
print"(i0)",mod(kaijo(N)*kaijo(M)*merge(1,1,M-N<=1)*merge(2,1,M==N),10**9+7)

contains
pure function kaijo(X)
  integer,intent(in)::X
  integer(8) kaijo
  kaijo=1
  do i=1,X
    kaijo=mod(kaijo*i,10**9+7)
  end do
end function kaijo
end