{"raw_statement":[{"iden":"statement","content":"You've traveled across a galaxy far, far away, and you land on a planet with two different alien species. Each alien species counts numbers in a different base. Aliens of the first species count numbers using base $a$, and aliens of the second species count numbers using base $b$. The base used by most humans is decimal, base 10.\n\nThe two alien species are about to start a war, because they cannot properly communicate in numbers. Your task is to convert a number from the first alien species, in base $a$, into base $b$, in order to avert the impending alien war.\n\nThe first line of input contains two integers $a$ and $b$ less than or equal to 10: the number base used by the first alien species, and the number base used by the second alien species, respectively.\n\nThe second line of input contains a single integer $n$ in base $a$.\n\nOutput $m$: the given integer, converted from base $a$ to base $b$.\n\n"},{"iden":"input","content":"The first line of input contains two integers $a$ and $b$ less than or equal to 10: the number base used by the first alien species, and the number base used by the second alien species, respectively.The second line of input contains a single integer $n$ in base $a$."},{"iden":"output","content":"Output $m$: the given integer, converted from base $a$ to base $b$."},{"iden":"examples","content":"Input7 9\n63642\nOutput23550\nInput10 3\n8790971\nOutput121112121221112\nInput5 6\n3124\nOutput1530\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ a, b \\in \\mathbb{Z} $ with $ 2 \\leq a, b \\leq 10 $ be the source and target bases, respectively.  \nLet $ n $ be a non-negative integer represented in base $ a $ as a string of digits $ d_k d_{k-1} \\dots d_0 $, where each $ d_i \\in \\{0, 1, \\dots, a-1\\} $.\n\n**Constraints**  \n1. $ 2 \\leq a \\leq 10 $  \n2. $ 2 \\leq b \\leq 10 $  \n3. $ n $ is a valid base-$ a $ numeral (no leading zeros unless $ n = 0 $)  \n\n**Objective**  \nConvert $ n $ from base $ a $ to base $ b $:  \nLet $ N = \\sum_{i=0}^{k} d_i \\cdot a^i $ be the decimal value of $ n $.  \nOutput the base-$ b $ representation of $ N $ as a string of digits $ m = e_\\ell e_{\\ell-1} \\dots e_0 $, where $ N = \\sum_{j=0}^{\\ell} e_j \\cdot b^j $ and each $ e_j \\in \\{0, 1, \\dots, b-1\\} $.","simple_statement":"Convert a number from base a to base b.","has_page_source":false}