import scala.io.StdIn._

object Main extends App {
  val n = readInt()
  if (n == 1){
    println(readLine.trim.split(' ').map(_.toInt).last)
  }else {
    val a::b::t = Array.tabulate(n){_ ⇒
      val Array(x, r) = readLine.trim.split(' ').map(_.toInt)
      Circle(x, r)
    }.toList
    println("%.10f".format(t.foldLeft(Intersection(a, b)){case (i, c) ⇒ i.intersection(c)}.distance))
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline def let[A](func: T ⇒ A): A = func(value)
    @inline def tap(func: T ⇒ Unit): T = {func(value); value}
  }
}
case class Circle(x: Long, radius: Long) {
  def crossDistance(that: Circle): Double = {
    val distance = math.abs(x - that.x)
    if (distance * distance + math.min(radius, that.radius) * math.min(radius, that.radius) <= math.max(radius, that.radius) * math.max(radius, that.radius)) math.min(radius, that.radius)
    else {
      val s = (distance + radius + that.radius) / 2.0
      val area = math.sqrt(s * (s - radius) * (s - that.radius) * (s - distance))
      area / distance * 2
    }
  }
}
case class Intersection(a: Circle, b: Circle) {
  def intersection(that: Circle): Intersection = {
    List(Intersection(a, b), Intersection(a, that), Intersection(that, b)).minBy(_.distance)
  }
  def distance: Double = a.crossDistance(b)
}

