eolymp
bolt
Try our new interface for solving problems
Problems

Kids in a Friendly Class

Kids in a Friendly Class

Kevin resembles his class in primary school. There were girls and boys in his class. Some of them were friends, some were not. But if one person considered another person a friend, the opposite was also true.

Interestingly, every girl had exactly a friends among girls and exactly b friends among boys, whereas every boy had exactly c friends among girls and exactly d friends among boys.

Kevin does not remember the size of his class. Help him reconstruct the class with minimal possible number of kids, such that the above conditions are satisfied.

Input

The only line contains four integers a, b, c and d (1a, b, c, d50).

Output

Output an example of a class of minimal possible size satisfying the above conditions.

The first line should contains two positive integers: m - the number of girls, and n - the number of boys.

Let’s assign numbers 1 through m to the girls and m + 1 through m + n to the boys.

Each of the next lines should contain a pair of distinct integers describing a pair of friends by their numbers. Each pair of friends should appear exactly once in this list.

Note

The class from the example output is shown below:

prb6270

Time limit 1 second
Memory limit 256 MiB
Input example #1
1 2 1 2
Output example #1
2 4
1 2
3 4
4 5
5 6
6 3
1 3
1 4
2 5
2 6
Source 2013 ACM NEERC, Northern Subregional Contest, St Petersburg, October 26