N = int(input())
katamuki = []
mod = 10**9+7
mugen = 0
gomi = 0
for i in range(N):
    a,b = [int(x) for x in input().split()]
    if a == 0 and b == 0:
        gomi += 1
        continue
    if b == 0:
        mugen += 1
        continue
    katamuki.append(a/b)
N -= gomi
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
        d[katamuki[i]] += 1
ans = 0
katamuki.sort()
for i in range(N-mugen):
    if katamuki[i] < 0:
        ans += pow(2,N-i-1-d[-1/katamuki[i]],mod)
    elif katamuki[i] == 0:
        ans += pow(2,N-i-1-mugen,mod)
    else:
        ans += pow(2,N-i-1,mod)
ans += 2**mugen - 1
print(ans % mod)