<a href="https://codeforces.com/contest/593/problem/B">https://codeforces.com/contest/593/problem/B</a>
Input Format
.
Output Format
.
Constraints
.
Notice
.
Example
Input
4 1 2 1 2 1 0 0 1 0 2
Output
NO