MOD = 1000000007
def gcd(a, b):
    if a < b:
        b, a = a, b
    return b if a % b == 0 else gcd(b, a % b)

def solve(n, a, b):
    zero = 0
    D = {}
    for i in range(n):
        p, q = a[i], b[i]
        if (p == 0) and (q == 0):
            zero += 1
        else:
            if p == 0:
                r = abs(q)
            elif q == 0:
                r = abs(p)
            else:
                r = gcd(abs(p), abs(q))
            k = tuple((p // r, q // r))
            if not k in D:
                D[k] = 0
            D[k] += 1
    group = {}
    for (p, q), v in D.items():
        if (q, -p) in group:
            group[q, -p] += v
        elif (-q, p) in group:
            group[-q, p] += v
        else:
            group[p, q] = v
    pow2 = [0] * (n+1)
    pow2[0] = 1
    for i in range(n):
        pow2[i+1] = (pow2[i] * 2) % MOD
    ans = 1
    for (p, q), v in group.items():
        t = pow2[D[p,q]]
        if (q, -p) in D:
            t += pow2[D[q,-p]] - 1
        elif (-q, p) in D:
            t += pow2[D[-q, p]] - 1
        ans = (ans * t) % MOD
    return ans + zero - 1

n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
print(solve(n, a, b))