Phibonacci
Time limit1sMemory limit256 MB
Given n and k, decide whether (P_n)^k equals A φ^k + B for integers A and B and print them modulo 1,000,000,007, or -1.
- Level
Hard9 of 10
- Topics
- Number theory, Math
- Solved
- No attempts yet
Problem
The Fibonacci numbers are defined by the recurrence below.
The Fibonacci numbers are closely tied to the golden ratio , one of the two roots of . One example of that tie is the closed form . Now use to define the Phibonacci numbers by the recurrence below.
If you set , then holds for every . The question here is whether can be written as for two integers and . If it can, print and . If it cannot, print -1.
Input
The first line contains two integers and , separated by a space.
The bounds are and .
Output
On the first line, print the two integers and with , each taken modulo 1,000,000,007 and separated by a space. If no such pair of integers exists, print -1.
Hint
For and , . The remainder of modulo 1,000,000,007 is 1,000,000,004.