The first line contains one integer T 1≤T≤104), denoting the number of test cases.
For each test case, the only line contains five integers k,B,d,l,r(0≤k≤109, 2≤B≤109, 1≤l≤r≤1018), as the statement shows.
3
2 2 0 1 5
1 4 3 11 45
10 14 11 19 198
6
19
1049