object Main {
  def solve(n: Int, m: Int): Int = {
    if (n == 0){
      if (m == 0){
        1
      }else{
        0
      }
    }else {
      (n * solve(m, n - 1)) % (1e9 + 7).toInt
    }
  }

  def main(args: Array[String]): Unit = {
    val Seq(n,m): Seq[Int] = io.StdIn.readLine().split(' ').map(_.toInt)
    val x = (solve(n,m) + solve(m,n)) % (1e9 + 7).toInt
    println(x)
  }
}