Find a pair of integers that satisfies simple arithmetic conditions around a given sum and difference.
Problem
You are given three integers , , and .
Find any pair of integers such that:
- ,
- ,
- and both and are divisible by .
If such a pair exists, print it in any order. Otherwise, report that it is impossible.
This is a small constructive arithmetic task: you only need to determine whether the conditions can be satisfied and, if so, output one valid pair.
Input Format
The input contains three integers , , and .
Output Format
If a valid pair exists, output two integers and separated by a space. Otherwise, output -1.
Constraints
- The values are integers.
- You only need to produce one valid pair if it exists.
- If no pair satisfies all conditions, output
-1.
Example 1
Input
10 2 2
Output
6 4
Explanation
The pair $6 and \4 sums to \10, their difference is \2, and both are divisible by \2$.
Example 2
Input
10 3 2
Output
-1
Explanation
No integers can have sum $10 and absolute difference \3 while both being divisible by \2$.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.