Problem:
Score : 100 points

Problem Statement

Compute A \times B.

Constraints

1 \leq A \leq 100

1 \leq B \leq 100

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the value A \times B as an integer.

Sample Input 1

2 5

Sample Output 1

10

We have 2 \times 5 = 10.

Sample Input 2

100 100

Sample Output 2

10000

Solution in Java (OpenJDK 11.0.6) (judge verdict: Runtime Error)

import java.util.Scanner;

public class Main {
    public static void main(final String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] A = new long[N];
        long m = 1l;

        for (int i = 0; i < N; i++) {
            A[i] = Long.parseLong(sc.next());
            if (A[i] == 0) {
                sc.close();
                System.out.println(0);
                return;
            }
        }

        sc.close();
        long max = (long) Math.pow(10d, 18);

        for (int j = 0; j < N; j++) {
            m = m * A[j];
            if (m > max || m < 0l) {
                System.out.println(-1);
                return;
            }
        }

        System.out.println((long) m);
    }
}