mod=10**9+7
n=int(input())
fact=[1]
fact_inv=[1]
for i in range(n+1):#<< Nの最大値
    new_fact=fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))

def mod_comb(n,k,mod):
    return fact[n]*fact_inv[k]%mod*fact_inv[n-k]%mod

ab=[list(map(int,input().split())) for _ in range(n)]
k=[]
for i in range(n):
    a,b=ab[i]
    k.append(b/a)
k.sort()
print(k)
from bisect import bisect_left, bisect_right
ans=pow(2,n,mod)-1
d={}
dd={}
for x in k:
    y=1/x
    c=bisect_right(k,-y)-bisect_left(k,-y)
    cc=bisect_right(k,x)-bisect_left(k,x)
    dame=0
    if c==0:
        continue
    for i in range(2,c+2):
        dame+=pow(2,n-i,mod)*mod_comb(c,i-1,mod)*mod_comb(cc,i-1,mod)
        dame%=mod
    x=max(x,-y)
    if x in d:
        d[x]+=1
    else:
        d[x]=1
    if x in dd:
        pass
    else:
        dd[x]=dame
for v in dd.values():
    ans-=v
print(ans)
