Bob just got an internship writing a graphics driver for a computer screen! The screen can be represented as an -pixel-high by -pixel-wide grid of square pixels, all the same size. Pixel coordinates range from in the bottom-left to in the top-right.
Bob's first task is to display a diagonal line across the screen. More specifically, if you imagine a straight line going from the bottom-left to the top-right corner of the screen, Bob needs to light up all the pixels touching that line. The line must fully intersect a pixel for it to be lit up; pixels that only touch the line at a corner should not be lit.
For example, if and , he should light up the pixels like this (yellow for lit, black for unlit):
Bob needs to know exactly which pixels should be lit. Please help him out so he doesn't get fired!
Subtask 1 [20%]
Subtask 2 [80%]
Two space-separated integers, and .
On the first line, print , the total number of pixels that should be lit.
Then on the next lines, print and , the coordinates (row and column) of the lit pixel. Pixels with lower should be printed first. If there is still a tie, print pixels with lower first.
14 1 1 1 2 2 2 2 3 2 4 3 4 3 5 4 6 4 7 5 7 5 8 5 9 6 9 6 10