{"problem":{"name":"188. Quaternary Addition","description":{"content":"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 gre","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269188"},"statements":[{"statement_type":"Markdown","content":"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.\n\nFor example, if you had the numbers 322312 and 213200 in base 4, the result would be 131112.\n\nGiven two numbers in base ten, apply this technique on them, and convert the result back into base 10.\n\nThe first line of input contains a single positive integer $a$.\n\nThe second line of input contains a single positive integer $b$.\n\nPrint the result of applying the operation described above on $a$ and $b$, converted back into decimal (Base 10).\n\n## Input\n\nThe first line of input contains a single positive integer $a$.The second line of input contains a single positive integer $b$.\n\n## Output\n\nPrint the result of applying the operation described above on $a$ and $b$, converted back into decimal (Base 10).\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ a, b \\in \\mathbb{Z}^+ $ be the two input integers.  \nLet $ A = (a_{m-1}, \\dots, a_0)_4 $ and $ B = (b_{m-1}, \\dots, b_0)_4 $ be the quaternary representations of $ a $ and $ b $, padded with leading zeros to equal length $ m = \\max(\\lfloor \\log_4 a \\rfloor + 1, \\lfloor \\log_4 b \\rfloor + 1) $.  \n\n**Operation**  \nDefine digit-wise addition modulo 4:  \nFor each digit position $ i \\in \\{0, \\dots, m-1\\} $, compute  \n$$\nc_i = (a_i + b_i) \\bmod 4\n$$  \nLet $ C = (c_{m-1}, \\dots, c_0)_4 $ be the resulting quaternary number.  \n\n**Objective**  \nCompute and output the decimal value of $ C $:  \n$$\n\\sum_{i=0}^{m-1} c_i \\cdot 4^i\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269188","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}