|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||64 MB||10||6||6||60.000%|
Recently Yerzhan invented a new type of laser that is capable of measuring distance to distant objects. As any invention, laser needs testing and Yerzhan wants to test it on a moving animate creature (don't ask the final purpose of this laser). Since using mouses is too mainstream, Yerzhan went to the Forbidden Forest in search of a right creature.
The story of Yerzhan catching Gorlum is quite fascinating, but it would be inappropriate to tell it right now. What is more important is that he found the subject of his experiments. The creature's name is Gorlum and, despite Yerzhan's efforts, Gorlum, being a pretty dumb creature, only learned to strictly perform 5 types of commands, denoted by Latin symbols for convenience:
For experiment purposes Yerzhan located his laser in point with coordinates (Laserx, Lasery) on a plane in Euclidean space. Yerzhan also taught Gorlum to understand and perform a list T of these 5 commands, where T is a string containing the commands in the order Gorlum must perform them. Gorlum starts at point (Gorlumx, Gorlumy).
Your task is to output the minimal and maximal distances to Gorlum detected by the laser. Your answer will be considered correct if the absolute or relative errors of the two numbers don't exceed 10−9.
First two lines of input contain a natural number K ≤ 105 and a string S (|S| ≤ 104), consisting of symbols "LRFBI". To obtain the list of commands T, simply concatenate S K-times to itself (in other words T = SK).
The last two lines contain two pairs of numbers: coordinates of location of the laser (Laserx, Lasery) and of Gorlum (Gorlumx, Gorlumy).
All coordinates are integer numbers, not exceeding 104.
Two real numbers - minimal and maximal detected distances. Absolute or relative errors of the numbers must not exceed 10−9.
100000 LRFBI 10000 10000 10000 10000