
def resolve():
    import math
    from fractions import Fraction
    mod = 10**9 + 7
    n = int(input())
    dic1 = {}
    dic1["all0"] = 0
    dic1["b0"] = 0
    dic1[Fraction(0,1)] = 0
    for i in range(n):
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            dic1["all0"] += 1
        elif b == 0:
            dic1["b0"] += 1
        else:
            c = math.gcd(a,b)
            a = a//c
            b = b//c
            if Fraction(a,b) in dic1:
                dic1[Fraction(a,b)] += 1
            else:
                dic1[Fraction(a,b)] = 1

    ans = 1
    all0 = 0
    for i in dic1:
        if i == "all0":
            all0 = dic1["all0"]
            continue
        elif i == "b0":
            counter = Fraction(0, 1)
            ans *= (2 ** dic1[i] + 2 ** dic1[counter] - 1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0
        elif i == Fraction(0,1):
            counter = "b0"
            ans *= (2 ** dic1[i] + 2 ** dic1[counter] - 1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0

        elif -1 * (Fraction(1,i)) in dic1:
            counter = -1 * (Fraction(1,i))
            ans *= (2**dic1[i]+2**dic1[counter]-1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0
        else:
            ans *= (dic1[i]+1)
            ans %= mod
    print(ans%mod-1)


resolve()