LearnPy Hub
← Arena
AdvancedRating 1700

Matrix Power

Raise the 2×2 matrix [[a, b], [c, d]] to the power n and print it modulo 1 000 000 007.

Input

a b c d n (n ≤ 10¹⁸).

Output

Two lines.

Sample 1

Input
1 1 1 0 10
Output
89 55
55 34

Sample 2

Input
2 0 0 2 3
Output
8 0
0 8
solution.py
Output appears here
Matrix Power · Python Arena problem · LearnPy Hub