Easy Accuracy: 22.58% Submissions: 155 Points: 2

A Padovan Sequence is a sequence which is represented by the following recurrence relation
P(N) = P(N-2) + P(N-3)
P(0) = P(1) = P(2) = 1
Given a number N, find the Nth number in this sequence.

Note: Since the output may be very large, compute the answer modulus 10^9+7.

Example 1:

Input:
N = 3
Output: 2
Explanation: P1 + P0 = P3
P1 = 1 and P0 = 1


â€‹Example 2:

Input:
N = 4
Output: 2
Explanation: P2 + P1 = P4
P2 = 1 and P1 = 1


You don't need to read input or print anything. Your task is to complete the function padovanSequence() which takes integer N as input parameter and return Nth number in Padovan Sequence.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N <= 106