Given a rectangle and two circles, decide whether both circles fit inside the rectangle without overlapping.
Medium4GeometryMathInterviewNo attempts yetTime limit2sMemory limit512 MBFCC, a carbon cylinder factory, makes several types of carbon cylinders. The factory is on the tenth floor of a building and uses the building's elevators to move the cylinders. Safety rules require every cylinder to travel upright. The cylinders are heavy, so at most two of them go in one elevator trip. The inside of an elevator is a rectangular box, and its height is always greater than the height of a cylinder.
To cut the number of trips, FCC wants to load two cylinders whenever that is possible. The figure below is a top view of a case where two cylinders fit (a) and a case where they do not (b).

Because the cylinders stand upright, the top view is two circles of radius R1 and R2, and both circles must lie inside a rectangle of width L and length C without overlapping. The two circles may touch each other, and they may touch the sides of the rectangle.
Given the size of the elevator and of the two cylinders, write a program that decides whether both cylinders fit in one trip.
The input contains several test cases. Each test case is one line with four integers L, C, R1 and R2 separated by spaces: the width of the elevator (1≤L≤100), the length of the elevator (1≤C≤100), and the radii of the two cylinders (1≤R1,R2≤100).
The line after the last test case contains four zeros separated by spaces. Do not process that line.
For each test case, print one line with a single character: S if both cylinders fit in the elevator, and N otherwise.