시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 256 MB 23 5 4 25.000%

문제

운동선수 유라의 코치 민혁이는 체력 측정을 위해서 유라에게 l 미터 달리기를 시키려고 한다. 유라는 v1 m/s 이상 v2 m/s 이하의 일정한 속력으로 달린다.

타이머를 이용하여 유라의 기록을 측정하려던 참에, 민혁이는 타이머를 갖고 오는 것을 잊어버렸다. 유라의 속력을 측정하는 것에 차질이 생긴 민혁이는 다른 방법을 이용하여 유라의 속력을 측정해야 한다.

민혁이는 특정 시점에 시작점과 도착점 사이의 특정 지역에 가서 유라가 이미 왔는지 확인할 수 있다. 이런 방식으로 몇 번 확인하다 보면 +-t/2 m/s의 오차 범위를 감안한 유라의 속력을 구할 수 있다.

민혁이가 특정 지점에 가서 유라의 도달 여부를 확인하는 데 최소 s초의 시간이 걸린다. 따라서 유라가 달리기를 시작한 후 s초 동안은 유라의 도달 여부를 확인할 수 없으며, 유라의 도달 여부를 확인한 후 그 다음 s초 동안 역시 유라의 도달 여부를 확인할 수 없다.

민혁이는 최악의 경우에도 최소한의 확인으로 유라의 속력을 측정하려고 한다. 민혁이를 도와 유라의 속력을 측정하는 전략을 짜는 프로그램을 작성하여라.

입력

입력의 첫 번째 줄에는 테스트 케이스의 수 c (1 ≤ c ≤ 100)가 주어진다.

두 번째 줄부터 c개의 줄에는 정수 l, v1, v2, t, s (1 ≤ l, v1, v2, t, s ≤ 109, v1 < v2)가 주어진다.

출력

각 테스트 케이스에 대해서 답을 한 줄에 하나씩 출력한다.

만약 민혁이가 오차 범위 내에서 유라의 속력을 구할 수 없다면 'impossible'을 출력한다. 그렇지 않은 경우 민혁이가 유라의 속력을 구하기 위한 최소 확인 수를 출력한다.

예제 입력 1

3
1000 1 30 1 1
60 2 10 2 5
59 2 10 2 5

예제 출력 1

5
3
impossible
W3sicHJvYmxlbV9pZCI6IjEwNzkwIiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHViMmVjXHViOWFjXHVhZTMwI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