Pavel had two positive integers a and b. He found their sum s and greatest common divisor g, and forgot a and b after that. Help him to restore the original numbers.
Input
A single line contains two integers s and g (1 ≤ s ≤ 109, 1 ≤ g ≤ 109) — sum and greatest common divisor of the numbers a and b.
Output
If Pavel made a mistake and there are no such numbers a and b, output a single number - 1.
Otherwise, output two positive integers a and b on a single line, separated by a space. If there are multiple possible solutions, output any of them.
Examples
Input
6 2
Output
4 2
Input
7 2
Output
-1
题意:给i出两个数的最大公因子g和两个数的和s求出这两个数
思路:因为g是这两个数的最大公因子所以这两个数都能整除g,又因为s是这两个数的和所以s一定能整除g(可以当作有无解的判定条件),所以s-g>0也一定能整除g,所以g与s-g符合条件是一组正解。
AC代码:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
using namespace std;
#define ll long long
int main()
{
ll s,p;
while(~scanf("%lld%lld",&s,&p))
{
if(s%p!=0||s<=p)
{
printf("-1\n");
continue;
}
printf("%lld %lld\n",p,p*((s/p)-1));
}
}