Олимпиадный тренинг

Задача 38774. Laser gun


Задача

Темы:
The space shooting game player has a very powerful laser gun. But it is immobile and can only fire in one direction. The player can place double-sided mirrors on the playing field that change the course of the beam to hit enemies. Let's introduce a Cartesian coordinate system with the center where the gun is located, that is, the gun has coordinates (0; 0). The cannon shoots in the direction of the point (1; 1). The player can place mirrors at points with integer coordinates. Mirrors can be horizontal or vertical, hitting the beam in the mirror changes the trajectory of the beam according to the laws of light reflection. Some possible options for reflecting a beam from a mirror are shown in the figure.

You need to arrange the minimum number of mirrors so that the laser beam hits the target.

Input
The program receives as input two integers X and Y , not exceeding 10000 in absolute value, written in different lines — target coordinates. Point (X; Y) does not match the origin.

Imprint
The program should output in the first line the number N — the required number of mirrors. The next N lines should contain information about each mirror. The i-th line should contain two space-separated integers xi and yi and one symbol ti , denoting the coordinates (xi ; yi) of the point where the i-th mirror is installed and the type of this mirror ti . If ti is the symbol "V", then the i-th mirror is placed vertically, if ti is the symbol "H", then the mirror is placed horizontally. For example, the string "-2 5 H" denotes a horizontal mirror at (.minus;2;5). Mirrors can be displayed in any order. A mirror cannot be placed at the point (0; 0), nor can two mirrors be placed at the same point. The values ​​of xi and yi must not exceed 100,000 in absolute value. Also, of course, the reflected beam must not be allowed to hit the cannon. If there are multiple answers, print any of them. If it is impossible to hit the target in accordance with the conditions of the problem, the program should display a single number "-1". If mirrors are not needed to hit the target, the program should print a single number "0"
 
Examples
# Input Output Explanation
1 5
1
1
3 3H