The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`int solution(int N, int M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`int solution(int N, int M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`int solution(int N, int M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`class Solution { public int solution(int N, int M); }`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`int solution(int N, int M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`func Solution(N int, M int) int`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`class Solution { public int solution(int N, int M); }`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`class Solution { public int solution(int N, int M); }`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`function solution(N, M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`fun solution(N: Int, M: Int): Int`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`function solution(N, M)`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`int solution(int N, int M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`function solution(N: longint; M: longint): longint;`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`function solution($N, $M);`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`sub solution { my ($N, $M) = @_; ... }`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`def solution(N, M)`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`def solution(n, m)`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`object Solution { def solution(n: Int, m: Int): Int }`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`public func solution(_ N : Int, _ M : Int) -> Int`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`function solution(N: number, M: number): number;`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

The Fibonacci sequence is defined by the following recursive formula:

F(0) = 0

F(1) = 1

F(N) = F(N−1) + F(N−2) for N ≥ 2

Write a function:

`Private Function solution(N As Integer, M As Integer) As Integer`

that, given two non-negative integers N and M, returns a remainder of F(N^{M}) modulo 10,000,103.

Note: 10,000,103 is a prime number.

For example, given N = 2 and M = 3, the function should return 21, since 2^{3} = 8 and F(8) = 21.

Write an **efficient** algorithm for the following assumptions:

- N and M are integers within the range [0..10,000,000].

Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.