from collections import defaultdict
from collections import deque
N=int(input())
MOD=1000000007

exist = defaultdict(int)
dup = defaultdict(float)
for _ in range(N):
    A,B=list(map(int,input().split()))
    rest =  -B/A
    corr = A/B
    if exist[rest] != 0:
        dup[rest]+=1
    exist[corr]=1

# a**n mod p
def power_func(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

ans = power_func(2,N,MOD) -1
for k,v in dup.items():
  minus = power_func(2,N-int(v)-1,MOD)
  ans -= minus
print(ans)