import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val A, B = sc.nextDouble
    val N = (math.max(A, B) - math.min(A, B)) / 2 + math.min(A, B)
    println(if (A - N < 90) (N) else {
      if (N + 180 >= 360) (N - 360) else (N)
    })
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    solve(sc)
  }
}