#Q218. 「一本通 6.4 练习 2」五指山

「一本通 6.4 练习 2」五指山

Description

Original problem from: NEFU 84

The Great Sage is within the Buddha's palm.

We assume the Buddha's palm is a circle with a circumference of nn, labeled counterclockwise as: 0,1,2,,n10,1,2,\cdots ,n-1. The Great Sage can fly a distance of dd each time. The Great Sage's current position is denoted as xx, and the destination is yy. Your task is to determine the minimum number of flights required for the Great Sage to reach the destination.

Input Format

There are multiple test cases.

The first line contains a positive integer TT, indicating the number of test cases.
Each test case consists of a single line with four non-negative integers: the circumference of the Buddha's palm nn, the flight distance dd, the initial position xx, and the destination yy.

Note that the Great Sage's flight is always in the counterclockwise direction.

Output Format

For each test case, output a single line with the minimum number of flights required for the Great Sage to reach the destination. If it is impossible to reach the destination, output Impossible.

Sample 1

2
3 2 0 2
3 2 0 1

1
2

Constraints and Notes

For all test cases, 2<n<109,0<d<n,0x,y<n2\lt n\lt 10^9,0\lt d\lt n,0\le x,y\lt n.