SMPDIV - Divisibility


Print all integers ai such that ai is divisible by x and not divisible by y, where 1 < ai < n < 100000.

Input

First, you are given t (t < 100) - the number of test cases. In each of the following t lines, 3 integers: n x y.

You might assume also that x < n and x is not divisible by y.

Output

In each of the following t lines, numbers requested in the problem description in the separated by a single space in ascending order.

Example

Input:
2
7 2 4
35 5 12
Output:
2 6
5 10 15 20 25 30

hide comments
Szymon Chaber: 2022-12-20 23:19:54

Trim your inputs - easy to get thrown off when parsing

anudeep1189: 2021-12-18 14:09:43

I am getting NZEC runtime error , while uploading the solution in c# , Anyone solved this problem in c#

aaronphilip_03: 2020-12-06 20:07:11

Easy xD

ichbinmandeep: 2020-04-27 14:48:06

easy one

raju_94: 2020-04-17 10:27:21

AC is one go..:D

codefantasy: 2020-03-24 21:30:09

AC in 1 go :D

proramlogo: 2020-02-29 20:37:02

How to handle input in Java ?

sanjeev30798: 2020-01-02 10:52:59

AC in 1st attempt

krishp: 2019-12-31 00:31:53

sick

Last edit: 2019-12-31 00:32:03
denyshubh: 2019-11-30 17:07:03

The Time complexity of this problem is O(1) !!!


Added by:kuszi
Date:2013-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64