{"problem":{"name":"Segment on Grid Paper","description":{"content":"Takahashi is drawing a segment on grid paper. From a certain square, a square that is $x$ squares to the right and $y$ squares above, is denoted as square $(x, y)$. When Takahashi draws a segment conn","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"relay_e"},"statements":[{"statement_type":"Markdown","content":"Takahashi is drawing a segment on grid paper.\nFrom a certain square, a square that is $x$ squares to the right and $y$ squares above, is denoted as square $(x, y)$.\nWhen Takahashi draws a segment connecting the lower left corner of square $(A, B)$ and the lower left corner of square $(C, D)$, find the number of the squares crossed by the segment.\nHere, the segment is said to _cross_ a square if the segment has non-empty intersection with the region within the square, excluding the boundary.\n\n## Constraints\n\n*   $1 \\leq A, B, C, D \\leq 10^9$\n*   At least one of $A \\neq C$ and $B \\neq D$ holds.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$A$ $B$ $C$ $D$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"relay_e","tags":[],"sample_group":[["1 1 3 4","4"],["2 3 10 7","8"]],"created_at":"2026-03-03 11:01:13"}}