import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

mod = 1000000007
n = ni()
from collections import defaultdict
ab = defaultdict(int)
ba = defaultdict(int)

for i in range(n):
    a,b = na()
    ab[a/b] += 1
    ba[a/b] += 1


dif = 0
al = pow(2,n,mod)-1
d = defaultdict(int)

for j,k in ab.items():
    if d[j] > 0:
        continue
    p = -1/j
    if ba[p] > 0:
        m = ba[p]
        dif += pow(2,n-k-m,mod)*(pow(2,k,mod)*pow(2,m,mod)-1-m-k)%mod
        d[p] += 1


print(int((al-dif)%mod))
