eolymp
bolt
Try our new interface for solving problems
Problems

Plus and xor

Plus and xor

Bitwise exclusive \textbf{OR} (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive \textbf{OR} to every pair of bits located on the same positions in binary notation of operands. In other words, a binary digit of the result is equal to 1 if and only if bits on the respective positions in the operands are different. For example, if \textbf{X = 101 = 01100101_2}, \textbf{Y} = \textbf{41} = \textbf{00101001_2}, then \textbf{X xor Y = 76 = 01001100_2}. In the programming language Pascal denotes bitwise exclusive or "\textbf{xor}", and in C / C + + - the symbol "\textbf{^}". Write a program, which takes two non-negative integers \textbf{A} and \textbf{B} as an input and nds two non-negative integers \textbf{X} and \textbf{Y}, which satisfy the following conditions: \begin{enumerate} \item \textbf{A = X + Y} \item \textbf{B = X xor Y}, where \textbf{xor} is bitwise exclusive \textbf{or}. \item \textbf{X} is the smallest number among all numbers for which the first two conditions are true. \end{enumerate} \InputFile The first line contains integer number \textbf{A} and the second line contains integer number \textbf{B} (\textbf{0} ≤ \textbf{A}, \textbf{B} ≤ \textbf{2^64 - 1}). \OutputFile Print in one line two non-negative integers \textbf{X }and \textbf{Y}. Print \textbf{-1 }if there is no answer.
Time limit 1 second
Memory limit 64 MiB
Input example #1
142
76
Output example #1
33 109
Input example #10
1367480970723947
584615739735395
Output example #10
391432615494276 976048355229671
Author Daniil Neyter
Source 2011 XXIV All-Ukrainian Informatics Olympiad, Cherkasy, March 26 - 31, Round 1