Simple

4.2

4 votes
Easy-Medium
Problem

Given a list of n numbers A1,A2 .... An. You have to calculate

 for i = 1 to n
 ans = (ans * (isPrime(A[i]) ? A[i] : 1)) mod p

p = 131071393213

Initially ans = 1

Input:

First line contains N

Next N lines contain A[i]'s

Output:

The answer as specified above.

Constraints:

1N1000

1A[i]1018

Problem Setter - Vaibhav Bansal

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?