atcoder#ABC296D. [ABC296D] M<=ab
[ABC296D] M<=ab
Score : points
Problem Statement
You are given positive integers and . Find the smallest positive integer that satisfies both of the conditions below, or print if there is no such integer.
- can be represented as the product of two integers and between and , inclusive. Here, and may be the same.
- is at least .
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the smallest positive integer that satisfies both of the conditions, or if there is no such integer.
5 7
8
First, cannot be represented as the product of two integers between and . Second, can be represented as the product of two integers between and , such as .
Thus, you should print .
2 5
-1
Since , , , and , only , , and can be represented as the product of two integers between and , so no number greater than or equal to can be represented as the product of two such integers. Thus, you should print .
100000 10000000000
10000000000
For , the product of and is , which is the answer. Note that the answer may not fit into a -bit integer type.