FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####
from fractions import Fraction as Fra, gcd
from collections import Counter

def solve(N, A):
    MOD = 10 **9 + 7
    # Cant if dot product is 0
    count = Counter()
    for x, y in A:
        g = gcd(x, y)
        if g:
            x //= g
            y //= g
        count[x, y] += 1
    m = max(count.itervalues())
    powers = [1]
    for i in xrange(m):
        powers.append(powers[-1] * 2 % MOD)
        
    # x,y = -y,x
    ans = 1
    for (x, y), c1 in count.iteritems():
        px, py = -y, x
        pg = gcd(px, py)
        if pg:
            px//=pg; py//=pg;
        c2 = count[px, py]
        if not c2:
            ans *= powers[c1]
            ans %= MOD
        elif (x,y) < (px,py):
            f = (powers[c1] + powers[c2] - 1)%MOD
            ans *= f
            ans %= MOD
    return (ans - 1) % MOD
    
    
N = rri()
A = [rrm() for _ in xrange(N)]
print solve(N, A)
