from decimal import Decimal, getcontext

getcontext().prec(100)
n = int(input())
nlist = {}
for i in range(n):
    a,b=map(int,input().split())
    div= Decimal(a)/Decimal(b) if b!=0 else "v"
    try:
        nlist[div]=nlist[div] +1
    except KeyError:
        nlist[div]=1
    
for i in nlist.keys():
    div=i
    if div=='v':
        to=Decimal(1)/div if div!=Decimal(0) else "v"
    else:
        to=Decimal(0)
    try:
        nlist[to]=nlist[to]*nlist[div]
    except KeyError:
        pass

ans=0
for i in nlist.values():
    ans+=i
print((2**n-ans)%1000000007)