Connecting Black and White Points

Time limit1sMemory limit128 MB

Problem

There are 2n points on the x-axis at coordinates 1, 2, ..., 2n. Exactly n of them are black and exactly n of them are white.

You must pair each black point with one white point, making n pairs in total. To connect one pair, start from the point with the smaller coordinate, go vertically upward, move horizontally to the right, and then go vertically downward to the other point. The height of each route may be chosen as a positive integer.

No two routes may overlap or cross. One unit of vertical distance and one unit of horizontal distance both have length 1. Pair all points so that the total length of the n routes is as small as possible.

Input

The first line contains an integer 2n, the number of points. 2n is an even integer not greater than 100.

The second line contains a string of length 2n. It consists of n zeroes and n ones, describing the points from left to right at coordinates 1, 2, ..., 2n. A 0 is a white point, and a 1 is a black point.

Output

Print the minimum possible total length on the first line.

Then print n lines, each containing two coordinates a b for one connected pair. The coordinates must satisfy a < b, and the lines must be printed in increasing order of a.