Sea Battle

medium
<a href="https://codeforces.com/contest/729/problem/D">https://codeforces.com/contest/729/problem/D</a>

Input Format

.

Output Format

.

Constraints

.

Notice

.

Example

Input
5 1 2 1
00100
Output
2
4 2
Previous
Minimum Number Of Steps
Next
Permutations

Related Questions