def gcd(a, b):
    return gcd(b,a%b) if b else a
n = int(input())
freq = {}
ans = 1
add = -1
for i in range(n):
    a,b=map(int, input().strip().split())
    if not (a or b):
        add += 1
        continue
    if not a:
        b = 1
    elif not b:
        a = 1
    else:
        if b < 0: a,b=-a,-b
        c = gcd(abs(a),b)
        a //= c; b //= c
        t = (a,b)
        if t not in freq:
            freq[t] = 1
        else:
            freq[t] += 1
mod = 1000000007
vis = set()
for i in freq:
    if i in vis: continue
    vis.add(i)
    a,b=i
    t = (b,-a) if a<=0 else (-b,a)
    if t in freq:
        vis.add(t)
        ans = ans*(pow(2,freq[t],mod)+pow(2,freq[i],mod)-1)%mod
    else:
        ans = ans*pow(2,freq[i],mod)%mod
print((ans+add)%mod)
