시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
0.5 초 512 MB 14 3 2 15.385%

문제

Samouel has an array A of N integers indexed from 1 to N. Initially, all of the integers are 0. His friend, Gregor also has an array B of N integers indexed from 1 to N.

Samouel wants to modify his array such that his array becomes equal to Gregor's. To achieve that, Samouel can apply the following operation: choose two consecutive indices i and i + 1 (1 ≤ i < N) and do either the following:

  • Increment Ai by 1 and increment Ai+1 by 2, or
  • Increment Ai by 2 and increment Ai+1 by 1.

Determine whether it is possible for Samouel to achieve his goal.

입력

The first line contains one integer: N (1 ≤ N ≤ 100) in a line denoting the length of both array A and B. The second line contains N integers: B1, B2, ..., BN (0 ≤ Bi ≤ 50,000) in a line denoting the value of array B.

출력

Output “YES" in a line if it is possible for Samouel to achieve his goal, or "NO" otherwise.

예제 입력 1

6
1 3 2 0 4 2

예제 출력 1

YES

예제 입력 2

3
2 8 2

예제 출력 2

YES

예제 입력 3

3
2 2 8

예제 출력 3

NO

예제 입력 4

5
0 0 0 0 3

예제 출력 4

NO

예제 입력 5

5
0 0 0 0 1

예제 출력 5

NO