import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque

inf = 10 ** 15
mod = 10 ** 9 + 7

def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


n = int(input())
zero = 0
aperb = []
bpera = []
for i in range(n):
    a,b = map(int, input().split())
    if a == 0 or b == 0:
        zero+=1
    else:
        aperb.append(a/b)
        bpera.append(-b/a)
badrelation = [] # 要素には仲悪いイワシのペア数
badnum = 0

aperb.sort()
bpera.sort()
length = len(aperb)
ind = 0
while ind < length:
    tmp = aperb[ind]
    if tmp > 0:
        break
    k = bisect.bisect_left(bpera, tmp)
    countb = 0
    while k < length and bpera[k] == tmp:
        countb+=1
        k+=1
    counta = 0
    while ind < length and aperb[ind] == tmp:
        counta+=1
        ind+=1
    if counta*countb != 0:
        badrelation.append([counta,countb])
        badnum += (counta+countb)

    if k == length or ind == length:
        break

nakayoshi = n-zero-badnum

ans = power(2,nakayoshi,mod)

ans = (ans*(zero+1))%mod
for ag,bg in badrelation:
    tmp = power(2,ag,mod)+power(2,bg,mod)-1
    ans = (ans*tmp)%mod

print(ans-1)