Periodic Ruler

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Hitagi has a ruler of infinite length. It has a mark on every integer, where the mark on integer ii has color c_ic\_i. Each color is represented by an integer from 11 to 100100.

She noticed that the ruler's color pattern repeats with a period of tt. The period tt is defined by the smallest positive integer that satisfies c_i=c_i+tc\_i = c\_{i+t} for all integers ii.

Hitagi told Koyomi the colors of nn marks of her choice. Koyomi wants to find all positive integers that cannot be a period of the ruler, regardless of the colors of unchosen marks. Write a program to find all such numbers, and output their count and sum.

입력

The first line contains a single integer n (1n50)n\ (1 \le n \le 50).

The following nn lines each contain two integers x_i (x_i109)x\_i\ (|x\_i| \le 10^9) and a_i  (1a_i100)a\_i\  (1 \le a\_i \le 100). This indicates that the integer x_ix\_i is marked with the color a_ia\_i.

If iji \neq j, then x_ix_jx\_i \neq x\_j.

출력

Output two integers on one line. The first integer is the number of positive integers that cannot be the period of the ruler. The second integer is their sum.