import scala.collection.mutable

object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val Array(r, c, ai, aj, bi, bj) = readLine.trim.split(' ').map(_.toInt)
  val state = Array.tabulate(r){_ ⇒ Array.tabulate(c){_ ⇒ Int.MaxValue}}.also{arr ⇒ arr(ai)(aj) = 0}
  val queue = mutable.Queue[(Coordinate, Int)]().also{q ⇒ q.enqueue((Coordinate(ai, aj), 0))}
  while (queue.nonEmpty){
    val (f, distance) = queue.dequeue()
    for (Coordinate(x, y) ← neighbors(f)) {
      if (state(x)(y) > distance + 1){
        state(x)(y) = distance + 1
        queue.enqueue((Coordinate(x, y), distance + 1))
      }
    }
  }
  val pattern = Array.tabulate(r){_ ⇒ Array.tabulate(c){_ ⇒ 0L}}.also{arr ⇒ arr(ai)(aj) = 1L}
  val isSearching = Array.tabulate(r){_ ⇒ Array.tabulate(c){_ ⇒ false}}.also{arr ⇒ arr(ai)(aj) = true}
  var stack:List[Coordinate] = List(Coordinate(ai, aj))
  while (stack.nonEmpty){
    stack = stack.flatMap{f ⇒
      val neighbor = neighbors(f)
      neighbor.foreach{t ⇒
        if (state(f.x)(f.y) + 1 == state(t.x)(t.y)) pattern(t.x)(t.y) = (pattern(f.x)(f.y) + pattern(t.x)(t.y)) % 1000000007L
      }
      neighbor.filter{
        case Coordinate(x, y) ⇒
          if (isSearching(x)(y)){
            false
          }else {
            isSearching(x)(y) = true
            true: Boolean
          }
      }
    }
  }
  println(s"${state(bi)(bj)} ${pattern(bi)(bj)}")

  def neighbors(coord: Coordinate): List[Coordinate] = {
    Coordinate(coord.x, 0)::Coordinate(coord.x, c - 1)::Coordinate(0, coord.y)::Coordinate(r - 1, coord.y)::List(Coordinate(1, 0), Coordinate(- 1, 0), Coordinate(0, 1), Coordinate(0, - 1)).map{_ + coord}.filter(p ⇒ (0 until r).contains(p.x) && (0 until c).contains(p.y))
  }
  case class Coordinate(x: Int, y: Int){
    def +(that: Coordinate): Coordinate = Coordinate(x + that.x, y + that.y)
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
