
Everybody knows that cake comes in two shapes, circular or rectangular.
Everybody except for Wesley.
In his defence:
You wouldn't buy a rectangular shaped pizza would you?
Thus Wesley has only ever cut his cake in one way.
- Imagine a Cartesian grid over the center of the cake labelled at
. - Make
cuts over the line formed by within the cake's boundaries.
With Wesley's birthday coming up, his friends have decided to play a little prank on him. They have purchased a square shaped cake with side length
Slope will be given as
Input Specification
The first line will contain two integers,
The next
Output Specification
Output two positive integers,
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Sample Input 1
1 2
-1 1
1 1
Sample Output 1
2 3
Explanation For Sample 1
The following image shows the cake:
The red square is the cake, and the blue and green lines show the two cuts. The black line shows one of the many different largest squares obtainable.
Sample Input 2
2 2
-1 2
1 1
Sample Output 2
3 2
Sample Input 3
1000 2
-1000 1
1000 1
Sample Output 3
2000000 2001
Comments