function longAngle(m) {
  // 1時間で360度, 12時間で12 * 360度
  // s = 6度/m
  return m * 6
}

function shortAngle(h, m) {
  // 1時間で360 /12 =30度
  // 12時間で360
  return 30 * (h + m/60)
}

function cosTheo(a, b, A) {
  return Math.sqrt(Math.abs(a * a + b * b - 2 * Math.cos(A) * a * a))
}

function main(input) {
  const a = 3
  const b = 4
  const h = 10
  const m = 0
  let angle = (Math.abs(longAngle(m) - shortAngle(h, m))) / 180 * Math.PI
  console.log(longAngle(m), shortAngle(h, m))

  if (angle > Math.PI) {
    angle = 2 * Math.PI - angle
  }
  if (angle === 0) {
    console.log(Math.abs(a - b))
  } else if (angle === Math.PI) {
    console.log(Math.abs(a + b))
  } else {
    console.log(cosTheo(a, b, angle))
  }
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));
