Prime Numbers

3

3 votes
Mathematics, Easy-Medium, Shortest path problem, Factorization
Problem

The author of this problem hopes that you still have not forgotten about the pig called Benny :)

Recently, she started learning numbers. The first type of numbers she has learnt is "Prime" numbers. The number is called prime if it has only 2 divisors including 1 and itself.

As a homework Benny was given two integers A and B. She has to transform A into B using addition and subtraction.

Here is only one restriction: since Benny knows only prime numbers she might add and subtract only prime numbers. Moreover, all the partial results also have to be prime numbers.

Your task is no find the way how Benny can transform number A into B with minimal number of additions and subtractions. If there are multiple ways - output "Poor Benny". If there is no way to transform A into B output "Unlucky Benny". Otherwise output the transformation with all partial results i.e you have to output A then -> then number in transformation then -> again and so on. The last number has to be equal to B. In other words A, B and any other temporary values during transformations should be separated by ->.

Input

The input data consists of only one single line containing two integers denoting A and B respectively.

Output

In a single line output the answer to the problem.

Constraints

  • 2A < B1015

It's guaranteed that A and B are prime numbers.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

In this test case Benny just has to add 2 to A and she will receive the expected result.

Editor Image

?