from math import gcd
from fractions import Fraction
from numpy import sign
N=int(input())
d={}
mod = 10**9+7
d={}
zeros = 0
b_zero = 0
a_zero = 0
for i in range(N):
    a, b = map(int,input().split(' '))
    a, b = map(lambda x:x//gcd(a,b),[a,b])
    if a == b == 0:
        zeros += 1
    elif a == 0:
        a_zero += 1
    elif b == 0:
        b_zero += 1
    else:
        h,t=sorted([Fraction(a,b),Fraction(-b,a)])
        key = str(h)+'/'+str(t)
        d.setdefault(key,[0,0])
        if a*b > 0:
            d[key][0] += 1
        else:
            d[key][1] += 1
ans = 1
for  v in d.values():
    h,t=sorted(v)
    if h>0:
        ans *= pow(2,h,mod) + pow(2,t,mod) -1
    else:
        ans *= pow(2,t,mod)
    ans %=mod
ans += pow(2,a_zero,mod) + pow(2,b_zero,mod) + zeros -3
print(ans)