from fractions import Fraction


N = int(input())

AB = [tuple(map(int, input().split())) for _ in range(N)]

MOD = 10**9 + 7

from collections import defaultdict

d = defaultdict(int)
ans = 1
cnt_00 = 0
for a,b in AB:
    if a == 0 and b == 0:
        cnt_00 += 1 
    elif a == b:
        d[1] += 1
    else:
        d[Fraction(a,b)] += 1




ans = 1
ks = list(d.keys())
for k in ks:
    if d[k] == 0:
        continue
    
    elif k == 1 or k == -1:

        num = pow(2,d[1]) + pow(2, d[-1])-1
        ans *= num
        ans %= MOD
        d[1] = 0
        d[-1] = 0

    else:

        num = pow(2, d[k]) + pow(2,d[Fraction(-1, k)])-1
        ans *= num
        ans %= MOD
        d[k] = 0
        d[Fraction(-1, k)] = 0
        



ans -=1
ans %= MOD
print(ans) 