## Problem F. Fractional multiplication ≡

• problems
• en ru
 Author: A. Baranov Time limit: 1 sec Input file: Standard input Memory limit: 256 Mb Output file: Standard output

### Statement

There is a set of N rational fractions, each is represented by corresponding numerator Ai and denominator Bi.

You must write a program that outputs:

• 0 — if the product of all fractions is either 1 or a prime;
• 1 — if it is integer non-prime;
• 2 — if it is a fractional number.

### Input format

Input contains integer N, followed by N pairs of integers (Ai, Bi).

### Output format

Output must contain a single integer — answer to the problem.

### Constraints

1 ≤ N ≤ 200, 1 ≤ (Ai, Bi) < 232

### Sample tests

No. Standard input Standard output
1
1
35880 17940

0
2
1
76824 12804

1
3
1
94803 11573

2

0.157s 0.017s 13