n = int(input())

abl = [map(int, input().split()) for _ in range(n)]

from collections import defaultdict
dic = defaultdict(int)

for a,b in abl:
    dic[b / a] += 1
MOD = 1000000007
ans = 1
used = defaultdict(int)
for d in dic:
    if -(1/d) in dic:
        if used[-(1/d)] == 0:
            ans *= pow(2, dic[d], MOD) + pow(2, dic[-(1/d)], MOD)  - 1
            used[d] = 1
    else:
        ans *= (dic[d] + 1)
    ans %= 1000000007


print(ans - 1)







