SOLVE

LATER

Find Product

Problem

Editorial

Analytics

You have been given an array *A* of size *N* consisting of positive integers. You need to find and print the product of all the number in this array **Modulo** \(10^9+7\).

**Input Format**:

The first line contains a single integer *N* denoting the size of the array. The next line contains *N* space separated integers denoting the elements of the array

**Output Format**:

Print a single integer denoting the product of all the elements of the array Modulo \(10^9+7\).

**Constraints**:

\( 1 \le N \le 10^3 \)

\( 1 \le A[i] \le 10^3 \)

Explanation

There are *5* integers to multiply. Let's store the final answer in \(answer\) variable. Since *1* is identity value for multiplication, initialize \(answer\) as *1*.

So the process goes as follows:

\(answer = 1\)

\(answer = (answer \times 1\)) % \((10^9+7)\)

\(answer = (answer \times 2\)) % \((10^9+7)\)

\(answer = (answer \times 3\)) % \((10^9+7)\)

\(answer = (answer \times 4\)) % \((10^9+7)\)

\(answer = (answer \times 5\)) % \((10^9+7)\)

The above process will yield answer as \(120\)

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
Bash,
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Swift-4.1,
TypeScript,
Visual Basic

Initializing Code Editor...

{"de2a615": "/pagelets/recommended-problems/algorithm/find-product/", "f5ef021": "/pagelets/problem-author-tester/algorithm/find-product/", "bc13d1a": "/pagelets/problems-hint/algorithm/find-product/", "b528ec9": "/pagelets/show-submission/algorithm/find-product/"}

realtime.hackerearth.com

80

d408a65c4192d8c048f6c17206d293713b6e1027

58a29e5cae2309f04b28

/realtime/pusher/auth/