Grammy likes to eat noodles. She divided a very long strip of noodle into N parts of unit length. Each part i has deliciousness a_i. She would like to fold the noodle into one piece of unit length before eating by repeating the following operation several (possibly, zero) times.
Let n be the current length of the noodle. In each operation, Grammy can choose a length ℓ such that 2ℓ≤n and a_i>0 for all i≤ℓ, and fold the noodle a_1,a_2,…,a_ℓ,a_ℓ+1,…,a_2ℓ,a_2ℓ+1,…,a_n into a_ℓ+1+a_ℓ,a_ℓ+2+a_ℓ−1,…,a_2ℓ+a_1,a_2ℓ+1,…,a_n, where n is the length of the noodle before the operation. After the operation, the length will become n−ℓ.
Grammy wants to know whether she can fold the noodle to length 1, can you tell her?
The first line of input contains a single integer N (1≤N≤100,000).
The second line contains N integers a_i (−20,000≤a_i≤20,000), representing the deliciousness of each part of the noodle.
If Grammy can fold the noodle to length 1, output a single line with the word "YES". Otherwise, output a single line with the word "NO".