object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val a = Array.fill(sc.nextInt())(sc.nextInt())
  val even = a.count(_ % 2 == 0)
  println(math.pow(3, a.length).toInt - math.pow(2, even).toInt)
  
}
