QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100

#76. Pianist

Statistiques

A pianist wants to play the piano.

The piano has $10^{100}$ keys, and the keys are labeled $A, B, C, D, E, F, G, A, B, \cdots$ from the left to the right. The pianist wants to satisfy the following constraints:

  • He chooses an $A$ key, and starts playing the piano by pressing the chosen key.
  • After he presses the $i$-th key, he can press either the $i-1$-th key or the $i+1$-th key in the next step.
  • After he presses an $A$ key, he can also stop playing the piano.
  • The first $A$ key and the last $A$ key he plays are not necessarily the same.
  • He must press $A$ keys (it doesn’t matter which $A$ keys) exactly $C_1$ times.
  • Similarly, he must press $B, C, D, E, F, G$ keys exactly $C_2, \ldots, C_7$ times, respectively.

Determine if it is possible to satisfy all the constraints above.

Input

$C_1\ C_2\ C_3\ C_4\ C_5\ C_6\ C_7$

  • $0 \leq C_i \leq 10^{10}$
  • $\sum C_i > 0$

Output

Print “YES” if it is possible to satisfy all the constraints, and “NO” otherwise.

Examples

Input 1

2 1 1 1 1 1 1

Output 1

YES

Input 2

1 1 1 1 1 1 1

Output 2

NO

Input 3

3 1 0 10000000000 10000000000 0 1

Output 3

NO

Input 4

1 0 0 0 0 0 0

Output 4

YES

Note

In Sample 1, he can play $A, B, C, D, E, F, G, A$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.