_{This problem is a programming version of Problem 45 from projecteuler.net}

Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:

It can be verified that

For this challenge you are given , , , where and

where represents triangular numbers, represents pentagonal numbers and is hexagonal. It can be observed that all hexagonal numbers are triangular numbers so we'll handle only 2 kinds of queries as

, find all numbers below N which are Triangular number as well as Pentagonal

, find all numbers below N which are Pentagonal number as well as Hexagonal

**Input Format**

Input contains three integers

**Output Format**

Print the answer corresponding to the test case. Print numbers in ascending oder.

**Constraints**

**Sample Input #00**

```
10000 3 5
```

**Sample Output #00**

```
1
210
```

**Sample Input #01**

```
100000 5 6
```

**Sample Output #01**

```
1
40755
```