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

object Main extends App with StdInHelper {
  val Array(a, b, h, m) = readInts

  val radM = 360 * m / 60
  val radH = radM / 12 + 360 * h / 12
  val cc = pow(a, 2) + pow(b, 2) - 2 * a * b * cos(toRadians(radM - radH))
  println(pow(cc, 0.5))
}

trait StdInHelper {
  def readInts = readLine.split(" ").map(_.toInt)
  def readLongs = readLine.split(" ").map(_.toLong)
}
