Given an even digit number N, partition the number into multiple numbers of two digits. For ex: if he chooses 1345 then he parts the number into 13 and 45. Calculate the product of these two digit numbers modulo (10^{9}+7).
 
Example 1:
Input:
N = 2222
Output:
484
Explanation:
2222 is divided into 22 and 22.
So, the result is 484.
Example 2:
Input:
N = 10
Output:
10
Explanation:
10 can be divided into only 10
so the result is 10. 
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function prodTwoDigit() which takes an Integer N as input and returns the product of two digit numbers when N is divided.
 
Expected Time Complexity: O(log_{100}N)
Expected Auxiliary Space: O(1)
 
Constraints:
2 <= N <= 10^{18}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3



class Solution:

    def prodTwoDigit(self, N):

        # code here 

Solutions:
import math

class Solution:

	def nod(self, n):
		return int(math.log10(n)) + 1

	def twoDigitNoArray(self, N):
		res = []
		prev = N
		curr = N // 100
		while curr != 0:
			res.append(prev - curr * 100)
			prev = curr
			curr = curr // 100
		res.append(prev)
		return res

	def prodTwoDigit(self, N):
		m = int(1000000000.0) + 7
		if N == 0:
			return 0
		elif self.nod(N) == 2:
			return N
		else:
			tdl = self.twoDigitNoArray(N)
			prod = 1
			for i in tdl:
				prod = prod * i % m
			return prod


class Solution:

	def prodTwoDigit(self, N):
		N = str(N)
		N = N[::-1]
		ans = 1
		i = 0
		while i < len(N):
			cur = N[i:i + 2][::-1]
			cur = int(cur)
			ans = ans * cur % 1000000007
			i += 2
		return ans


class Solution:

	def prodTwoDigit(self, N):
		mod = 10 ** 9 + 7
		if N == 0:
			return 0
		p = 1
		while N > 0:
			p = p * (N % 100) % mod
			N = N // 100
		return p


class Solution:

	def prodTwoDigit(self, N):
		if N == 0:
			return 0
		product = 1
		while N > 0:
			product = product * (N % 100)
			N = N // 100
		return product % (10 ** 9 + 7)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.prodTwoDigit(N))