from collections import defaultdict
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
    mod = 10**9+7
    dplus = defaultdict(lambda: 0)
    dminus = defaultdict(lambda: 0)
    N = int(input())
    xzero = 0
    yzero = 0
    for i in range(N):
        x,y = map(int, input().split())
        if x==0:
            xzero += 1
        elif y==0:
            yzero += 1
        elif x/y>0:
            dplus[x/y] += 1
        else:
            dminus[-y/x] += 1
    pattern = 1
    other = N
    pattern = pow(2,xzero,mod)+pow(2,yzero,mod)-1
    other = N-xzero-yzero
    for k,v in dplus.items():
        pattern *= pow(2,dminus[k],mod)+pow(2,v,mod)-1
        other -= dminus[k]+v
    ans = pattern * pow(2,other,mod) - 1
    ans %= mod
    return ans
print(solve())