main=map read.words<$>getLine>>=print.(\x->mod(product x)1000000007).(\x->[fact (x!!0),fact (x!!1),if (mod((x!!0)-(x!!1))2)==0 then 2 else 1]).(\x->if (abs((x!!0)-(x!!1)))>1 then [-1,-1] else x)
 where fact x | x==0 = 1
              | x>0  = mod(x*(fact (x-1)))1000000007
              |otherwise = 0