#C5186. Amiable Numbers Finder

    ID: 48807 Type: Default 1000ms 256MiB

Amiable Numbers Finder

Amiable Numbers Finder

An amiable pair (also known as a friendly or amicable pair) consists of two distinct natural numbers \(a\) and \(b\) such that the sum of the proper divisors (divisors excluding the number itself) of \(a\) is equal to \(b\) and vice versa. In mathematical notation, if \(\sigma(a) - a = b\) and \(\sigma(b) - b = a\), then \((a, b)\) is an amiable pair.

Your task is to find an amiable pair in the inclusive range \([low, high]\). If there are multiple pairs, output the first such pair found by iterating over \(a\) from low to high. If no amiable pair exists in the range, output "-1 -1".

The input guarantees that 1 ≤ low ≤ high ≤ 105.

inputFormat

The input consists of a single line with two space-separated integers low and high representing the lower and upper bounds of the range.

outputFormat

Output a single line containing two space-separated integers. If an amiable pair \((a, b)\) exists in the interval, output them as a b. Otherwise, output "-1 -1".

## sample
200 300
220 284

</p>