PLYGRND - Playground

no tags 

George has K ≤ 20 steel wires shaped in the form of half-circles, with radii a1, a2 ... aK. They can be soldered (connected) at the ends, in any angle. Is it possible for George to make a closed shape out of these wires? He does not have to use all the wires. The wires can be combined at any angle, but may not intersect. Beware of floating point errors.

Input

Each data set consists of a number 0 < K ≤ 20 on a line by itself, followed by a line of K space-separated numbers ai. Each number is in the range 0 < ai < 10^7, and has at most 3 digits after the decimal point. 

The input will be terminated by a zero on a line by itself.

Output

For each test case, there should be one word on a line by itself; “YES” if it is possible to make a simple connected figure out of the given arcs, and “NO” if it isn’t.

Example

Input:
1
4.000
2
1.000 1.000
3
1.455 2.958 4.424
7
1.230 2.577 3.411 2.968 5.301 4.398 6.777
0

Output:
NO
YES
NO
YES

hide comments
beginner: 2013-07-03 10:06:35

after solving this problem one should try
http://www.codechef.com/problems/TKCONVEX

Sanchit Manchanda: 2012-12-26 16:49:03

nice problem. one thing to keep in mind you can use any number of arcs from the available arc.
i was doing this mistake earlier that i wrote a code where i have to make a closed figure by using all the arcs.


Added by:Mohammad Kotb
Date:2010-08-27
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: OBJC VB.NET
Resource:NCPC 2005