import sys
import math
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    MOD = 1000000007
    d = {}
    
    pd = [1]
    for _ in range(N):
        pd.append((pd[-1]*2)%MOD)

    zero = 0
    ab = [0,0]
    for i in range(N):
        a,b = map(int,input().split())
        if a == b == 0:
            zero += 1
        elif a*b == 0:
            if a == 0:
                ab[0] += 1
            else:
                ab[1] += 1
        else:
            gcd = math.gcd(abs(a),abs(b))
            a //= gcd
            b //= gcd
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            elif a < 0 and b > 0:
                a,b = b,a
            elif a > 0 and b < 0:
                a *= -1
                b *= -1
                a,b = b,a
            if (a,b) not in d:
                d[(a,b)] = 1
            else:
                d[(a,b)] += 1

    ans = 1
    use = {}
    
    for k,v in d.items():
        a,b = k
        if (a,-b) in d:
            if (a,-b) in use:
                continue
            ret = pd[d[(a,b)]]+pd[d[(a,-b)]]-1
            ans *= ret
            use[(a,b)] = 1
            use[(a,-b)] = 1
        else:
            ret = pd[d[(a,b)]]
            ans *= ret
            use[(a,b)] = 1

    ret = pd[ab[0]]+pd[ab[1]]-1
    ans *= ret
    ans += zero
    
    print(ans-1)
    
if __name__ == "__main__":
    main()
