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.
InputThe first line of input contains a single positive integer $$$a$$$.
The second line of input contains a single positive integer $$$b$$$.
OutputPrint the result of applying the operation described above on $$$a$$$ and $$$b$$$, converted back into decimal (Base 10).
ExamplesInput7 9Output
12Input
67 130Output
193Input
45 1003Output
964