| OMORI CONTEST |
|---|
| Finished |
Kel was sitting bored on Mari's picnic blanket as everyone else was doing something, but after sometime he had an idea how to spend his time! He asked Basil to borrow his camera, and Basil agreed.
Mari's picnic blanket consists of $$$4$$$ different rectangular pieces each of dimensions $$$L \times W$$$, linked in a way such that the whole blanket has dimensions $$$2L \times 2W$$$.
Basil's camera has a laser like technique which generates laser from both sides (frontview and back view) to take $$$1\text{D}$$$ pictures; the laser can be thought of as a straight line (even though the actual camera can not generate an infinite straight line, Kel assumes it is a straight line as the blanket's dimensions are not too big).
Kel is trying to place and orient the camera in a way such that the generated laser passes by all $$$4$$$ rectangles in the blanket. A straight line is said to pass by a rectangle if a line segment of non-zero length — which is a subset of that straight line — intersects the rectangle.
Now Kel wants to find the number of different straight lines generated from his placement and orientation that can pass by all $$$4$$$ rectangular pieces in the blanket. Since this number can be large, you are asked to output it modulo $$$10^9+7$$$.
The first line of input contains two integers $$$L, W$$$ $$$(1 \le L, W \le 10^6)$$$ — The dimensions of each rectangle.
Output one line containing one integer, the number of different straight lines passing through all $$$4$$$ rectangles modulo $$$10^9+7$$$.
1 1
2
2 2
2
There are two possible straight lines for this blanket ![]() | ![]() |
Kel trying to orient the camera to get all $$$4$$$ rectangles
| Name |
|---|


