## COCI '19 Contest 1 #2 Lutrija

View as PDF

Points: 12
Time limit: 1.0s
Memory limit: 512M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Grandpa Vedran is watching his favorite lottery show on TV in the hopes of becoming an overnight millionaire. The lottery balls are spinning and bouncing around before yielding the following draw: , , , , , and .

Vedran sighs as he didn't guess a single one of those numbers. "Looks like I'm past my prime...", he thought to himself while turning off the old TV. His vision is also getting worse, so he pressed the wrong button on the remote control and switched to the COCI channel.

The host, Mr. Malnar, calmly spoke: "Dear viewers, on the left side of the screen I will show you a prime number and on the right side of the screen I will show you a prime number . The first person that calls in with an array of prime numbers which starts with , ends with and has a prime absolute difference between each two neighbouring elements will receive a free trip to IOI 2020 in Singapore."

Old Vedran is reminiscing about his glory days of being a competitive programmer. Unfortunately, he is rusty and is not able to solve the problem. Being kindhearted, you decide to help Vedran win a trip to Singapore.

Note: A prime number is a positive integer greater than that is only divisible by and itself.

#### Input

The first line contains two prime numbers and () from the task description.

#### Output

If the task is impossible, i.e., there is no array satisfying the conditions from task statement, simply output in a single line.

Otherwise, in the first line output the number of elements in the array and in the second line output its elements separated by spaces. The size of array must not be greater than and its elements must not be greater than . It is guaranteed that, if a solution exists, there is at least one satisfying those bounds.

If there are multiple correct solutions, output any of them.

#### Scoring

In test cases worth a total of 20% of the points, it will hold that if a solution exists, there is at least one such that the number of elements in the resulting array is not greater than and all of its elements are not greater than . In test cases worth additional 40% of the points, it will hold that .

#### Sample Input 1

13 11

#### Sample Output 1

2
13 11

#### Sample Input 2

37 11

#### Sample Output 2

-1

#### Sample Input 3

2 17

#### Sample Output 3

3
2 19 17