import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
ab=[list(map(int,input().split())) for i in range(n)]

dic=defaultdict(int)
zero=[0,0]
kasu=0
for i in range(n):
    a,b=ab[i]
    if a==0 and b==0:
        kasu+=1
    elif a==0:
        zero[0]+=1
    elif b==0:
        zero[1]+=1
    else:
        dic[a/b]+=1

anslst=[]
lst=list(dic.items())
ans=1

for i in range(len(lst)):
    num,m=lst[i]
    tmp=1
    if dic[num]!=0:
        tmp=pow(2,m,mod)-1+pow(2,dic[-1/num],mod)-1+1
        dic[-1/num]=0
    anslst.append(tmp)


anslst.append(pow(2,zero[0],mod)-1+pow(2,zero[1],mod)-1+1)

for i in anslst:
    ans*=i
    ans%=mod
ans=(ans-1+kasu)%mod
print(ans)