program main
	implicit none
    integer(8) n,m,t
    integer(8),parameter::x=1000000007_8
    integer(8)::ans=1
    read *,n,m
    t=mod(n+m,2)
    if(abs(n-m)>1) then
    	print '(i0)',0
        stop
    end if
    do while(n>0)
       	ans=ans*n
        ans=mod(ans,x)
        n=n-1
    end do
    do while(m>0)
        ans=ans*m
        ans=mod(ans,x)
        m=m-1
   	end do
    if(t==0) then
    	ans=ans*2
        ans=mod(ans,x)
    end if
    print '(i0)',ans
end program main