# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read


n,*ab = [int(i) for i in read().split()]

M = iter(ab)
d = {}

from math import gcd
for a,b in zip(M,M):
    if a==b==0: continue
    g = gcd(a,b)
    a//=g
    b//=g
    if b < 0:
        a = -a
        b = -b
    if b==0 and a == -1:
        a = 1
    
    if a > 0:
        if (a,b) in d:
            d[(a,b)][0] += 1
        else:
            d[(a,b)] = [1,0]
    else:
        if (b,-a) in d:
            d[(b,-a)][1] += 1
        else:
            d[(b,-a)] = [0,1]
        


MOD = 1000000007
ans = 1

pow2 = [1]
for _ in range(200005):
    pow2.append(pow2[-1]*2%MOD)

#print(d)
for (a,b),(k,l) in d.items():
    ans *= pow2[k]+pow2[l]-1
    ans %= MOD


ans -= 1
print(ans%MOD)


