from collections import defaultdict
from decimal import Decimal
N = int(input())

MOD = 10 ** 9 + 7

T = defaultdict(int)

ans = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    ans += 2 ** (i - T[Decimal(b)/Decimal(a)])
    ans %= MOD
    T[- Decimal(a)/Decimal(b)] += 1

print(ans)
