from fractions import Fraction
N, = map(int, input().split())
d = dict()
X = []
cc = 0
for _ in range(N):
    a, b = map(int, input().split())
    if a == 0 and b==0:
        cc += 1
        continue
    f = Fraction(a, b)
    if f not in d:
        d[f] = 0
    d[f] += 1
    X.append((a, b))

vs = dict()
cs = []
for a, b in X:
    f1 = Fraction(a, b)
    f2 = Fraction(b, -a)
    if f2 not in d:
        d[f2] = 0
#        cs.append(d[f1])
#        continue
    if f1 in vs or f2 in vs:
        continue
    vs[f1] = (d[f1], d[f2])
mod = 10**9+7

tmp = []
r = 1
#print(pow(2, sum(cs),mod))
r2 = 1
for k in vs:
    a, b = vs[k]
#    print((pow(2, a, mod), pow(2, b, mod)))
    r = r * (pow(2, a, mod) + pow(2, b, mod)-1) % mod
#    r2 = r2 * (pow(2, a-1, mod) + pow(2, b-1, mod)+2) % mod

print(r-1+cc)
#print(len(vs))
#print(r2)
#print(r2*pow(2, sum(cs),mod)+1)
