import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val mod = 1000L * 1000L * 1000L + 9

  val m, n = sc.nextInt

  println(solve(m, n))

  def solve(m: Int, n: Int): Long = {
    val mc = p(m)
    val nc = p(n)

    (m, n) match {
      case _ if m == n + 1 || m + 1 == n =>
        (mc * nc) % mod
      case _ if m == n => (mc * nc * 2) % mod
      case _ => 0L
    }
  }

  def p(i: Int): Long = {
    Range(1, i + 1)
      .map(_ * 1L)
      .reduce((a, b) => (a * b) % mod)
  }
}
