{"raw_statement":[{"iden":"statement","content":"You have two variables _a_ and _b_. Consider the following sequence of actions performed with these variables:\n\n1.  If _a_ = 0 or _b_ = 0, end the process. Otherwise, go to step 2;\n2.  If _a_ ≥ 2·_b_, then set the value of _a_ to _a_ - 2·_b_, and repeat step 1. Otherwise, go to step 3;\n3.  If _b_ ≥ 2·_a_, then set the value of _b_ to _b_ - 2·_a_, and repeat step 1. Otherwise, end the process.\n\nInitially the values of _a_ and _b_ are positive integers, and so the process will be finite.\n\nYou have to determine the values of _a_ and _b_ after the process ends."},{"iden":"input","content":"The only line of the input contains two integers _n_ and _m_ (1 ≤ _n_, _m_ ≤ 1018). _n_ is the initial value of variable _a_, and _m_ is the initial value of variable _b_."},{"iden":"output","content":"Print two integers — the values of _a_ and _b_ after the end of the process."},{"iden":"examples","content":"Input\n\n12 5\n\nOutput\n\n0 1\n\nInput\n\n31 12\n\nOutput\n\n7 12"},{"iden":"note","content":"Explanations to the samples:\n\n1.  _a_ = 12, _b_ = 5 _a_ = 2, _b_ = 5 _a_ = 2, _b_ = 1 _a_ = 0, _b_ = 1;\n2.  _a_ = 31, _b_ = 12 _a_ = 7, _b_ = 12."}],"translated_statement":[{"iden":"statement","content":"你有两个变量 #cf_span[a] 和 #cf_span[b]。考虑对这两个变量执行以下操作序列：\n\n最初，#cf_span[a] 和 #cf_span[b] 的值为正整数，因此该过程将是有限的。\n\n你需要确定过程结束时 #cf_span[a] 和 #cf_span[b] 的值。\n\n输入的唯一一行包含两个整数 #cf_span[n] 和 #cf_span[m]（#cf_span[1 ≤ n, m ≤ 1018]）。#cf_span[n] 是变量 #cf_span[a] 的初始值，#cf_span[m] 是变量 #cf_span[b] 的初始值。\n\n请输出两个整数——过程结束时 #cf_span[a] 和 #cf_span[b] 的值。\n\n样例解释：\n\n"},{"iden":"input","content":"输入的唯一一行包含两个整数 #cf_span[n] 和 #cf_span[m]（#cf_span[1 ≤ n, m ≤ 1018]）。#cf_span[n] 是变量 #cf_span[a] 的初始值，#cf_span[m] 是变量 #cf_span[b] 的初始值。"},{"iden":"output","content":"请输出两个整数——过程结束时 #cf_span[a] 和 #cf_span[b] 的值。"},{"iden":"examples","content":"输入12 5输出0 1输入31 12输出7 12"},{"iden":"note","content":"样例解释：#cf_span[a = 12], #cf_span[b = 5]  #cf_span[a = 2], #cf_span[b = 5]  #cf_span[a = 2], #cf_span[b = 1]  #cf_span[a = 0], #cf_span[b = 1]；#cf_span[a = 31], #cf_span[b = 12]  #cf_span[a = 7], #cf_span[b = 12]。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ be the initial values of variables $ a $ and $ b $, respectively.  \n\n**Process**  \nWhile $ a > 0 $ and $ b > 0 $:  \n- If $ a \\geq b $, set $ a \\leftarrow a - b $.  \n- Else, set $ b \\leftarrow b - a $.  \n\n**Constraints**  \n$ 1 \\leq n, m \\leq 10^{18} $\n\n**Objective**  \nCompute the final values of $ a $ and $ b $ after the process terminates.","simple_statement":null,"has_page_source":false}