eolymp
bolt
Try our new interface for solving problems
Problems

Function 9

Function 9

Write a program that finds the value of the function $$ f(m, n) = \begin{cases} f(m - n, n), m > n \\ n, m = n \\ f(n - m, m), n > m \end{cases} $$ \InputFile Two positive integers $n$ and $m~(1 \le n, m \le 10^{18})$. \OutputFile Print the value of the function $f(m, n)$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
6 3
Output example #1
3
Input example #2
12 12
Output example #2
12