#P1306. 斐波那契公约数
斐波那契公约数
Description
For the Fibonacci sequence:
$$f_i = \begin{cases} [i = 1] & i \leq 1 \\ f_{i - 1} + f_{i - 2} & i \gt 1 \end{cases}$$Compute the greatest common divisor of and , i.e., .
Input Format
One line contains two positive integers and .
Output Format
Output one integer, the greatest common divisor of and . Print the answer modulo .
4 7
1
Hint
- For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号