Problem E. Error detection

Author:I. Tuphanov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  

Statement

FEFU computer scientists use a duplication method to detect errors in network data transfer. Each bit of data is duplicated. The duplicate follows the original bit. Each byte therefore is transferred as a message of two bytes. The first byte of the message encodes high bits of the original byte, the second byte encodes low bits.

For example, a byte 67 is encoded as follows:

  1. 6710 = 010000112;
  2. the sequence 01000011 is encoded as 0011000000001111;
  3. the sequence 0011000000001111 is split into 00110000 and 00001111;
  4. 001100002 = 4810, 000011112 = 1510, so the result is 4815

Scientists received two bytes. Now they need to find out what the original byte was.

Input file format

Input file contains two integers designating two received bytes.

Output file format

Output file must contain a single integer — the original byte, or  − 1 if there was an error during transfer.

Constraints

Both input integers are in the range from 0 to 255.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
48 15
67
2
48 7
-1

0.156s 0.037s 13