407217: GYM102697 188 Quaternary Addition

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

188. Quaternary Additiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 25 points.

You have two numbers, and you decide to apply a special addition technique on them: you convert both numbers to quaternary (base 4), and add each digit pair separately. If this results in a number greater than or equal to 4, you subtract four from the result.

For example, if you had the numbers 322312 and 213200 in base 4, the result would be 131112.

Given two numbers in base ten, apply this technique on them, and convert the result back into base 10.

Input

The first line of input contains a single positive integer $$$a$$$.

The second line of input contains a single positive integer $$$b$$$.

Output

Print the result of applying the operation described above on $$$a$$$ and $$$b$$$, converted back into decimal (Base 10).

ExamplesInput
7
9
Output
12
Input
67
130
Output
193
Input
45
1003
Output
964

加入题单

上一题 下一题 算法标签: