#C5017. Product of Primes
Product of Primes
Product of Primes
Given an integer N, calculate the product of all prime numbers less than or equal to N.
Formally, for a given integer N, compute
[
P(N) = \prod_{\substack{p \leq N \ p \text{ is prime}}} p,
]
where a prime number is defined as an integer (p > 1) that has no positive divisors other than 1 and (p). If no prime numbers exist (i.e. when (N < 2)), output 1.
inputFormat
The input consists of a single integer N provided via standard input (stdin).
outputFormat
The output is a single integer which is the product of all prime numbers less than or equal to N. If there is no prime number in the range, output 1. The result is printed to standard output (stdout).## sample
5
30