Survival Route

시간 제한1초메모리 제한1024 MB

요약
구면 위에서 O를 중심으로 한 반지름 r의 방사선 구역을 피해 B에서 A로 가는 최단 경로의 길이를 구한다.
난이도

어려움10점 중 8점

유형
기하, 수학, 최단 경로, 구현
정답자
아직 제출이 없습니다

문제

The surface of recently discovered planet i1c5l is a perfectly shaped sphere with radius RR. Earth’s aerospace forces sent a research module Waldemar-63 that was supposed to land on the planet’s surface at point AA. However, due to miscalculation, Waldemar-63 got to point BB instead. Fortunately, Waldemar series are equipped with a train of wheels that will help in getting to the initial destination point. Nevertheless, power capacity is quite limited so it is important to get to point AA by minimal distance run.

A major complication is that some point OO on the surface of the planet radiates waves of unknown origin. The waves spread inside the radius rr (the distance is measured on the surface). As the previous 62 missions show, any device that gets into the radiation area instantly breaks down. Thus, Waldemar-63’s route should avoid the radiation area. Find the minimal distance that the device has to undertake from BB to AA.

입력

The first line contains integers X_AX\_A, Y_AY\_A (−90≤X_A≤90-90 \le X\_A \le 90, 180≤Y_A≤180180 \le Y\_A \le 180) --- coordinates (latitude and longitude in degrees) of point AA. Second line --- coordinates of point BB. Third --- three integers: coordinates of point OO and the radiation radius rr. In the fourth line --- positive integer not exceeding 1000 --- planet’s radius RR. It is guaranteed that points AA and BB are beyond the area of radiation.

출력

Output the distance determined. The answer is considered correct if the absolute or relative error is less than 10−410^{-4}.

예제1

  1. 예제 1

    입력
    55 49
    55 129
    90 0 1
    2
    
    예상 출력
    1.510687