Matrix power
Statement
You are given a <<2x2>> matrix [[M]] and an integer [[n]].
You have to compute the [[n]]-th power of [[M]].
Input description
<<Line 1 :>> First line of the matrix.
<<Line 2 :>> Second line of the matrix.
<<Line 3 :>> An Integer [[n]].
Output description
<<Line 1 :>> First line of [[M]] to the power of [[n]]
<<Line 2 :>> Second line of [[M]] to the power of [[n]]
Constraints
0 ≤ [[n]] ≤ 5000
Game modes
Test cases
Simple test Test
Input
1 0
0 2
2
Output
1 0
0 4
Simple test Validator
Input
1 0
0 2
3
Output
1 0
0 8
Small n Test
Input
1 2
3 4
3
Output
37 54
81 118
Small n Validator
Input
1 2
3 4
4
Output
199 290
435 634
Big n Test
Input
1 2
0 1
1234
Output
1 2468
0 1
Big n Validator
Input
1 2
0 1
4321
Output
1 8642
0 1
Zero power Test
Input
12 21
21 12
0
Output
1 0
0 1
Zero power Validator
Input
21 12
12 21
0
Output
1 0
0 1
Solution language
Solution
Stub generator input