The below is an interview question which I was unable to solve and needs some help.
Question:
A Person is playing with paper and during his game he folds the paper vertically in one turn and then horizontally in another turn and repeats the process n number of times. After he's done he cuts the paper vertically and horizontally. The task at hand is to take a number "N" as input and find the count of paper pieces that will be there after cutting the paper vertically and horizontally after folding it n times following the pattern as mentioned above.
Constraints:
1< N <10^5
N : Total number of turns
As the answer can be very large output the result mod 10^9+7
Test Cases
Input: 0
Output: 4
Input: 1
Output: 6
Input: 2
Output: 9
Input: 3
Output: 15
I tried to find some number pattern but couldn't find any also this question doesn't seem related to any algorithm and thus I was unable to find any proper approach. Please help suggesting some approach.