from collections import Counter
import sys
input = sys.stdin.buffer.readline

N = int(input())

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

def make(a, b):
    s = 1 if a * b >= 0 else -1
    a, b = abs(a), abs(b)

    g = gcd(a, b)
    a //= g
    b //= g

    return (a, b, s)

ABS = Counter([make(*map(int, input().split())) for _ in range(N)])

ans = 1
MOD = 10**9 + 7

for a, b, s in list(ABS.keys()):
    p = ABS[(a, b, s)]
    n = ABS[(b, a, -s)]

    ABS[(a, b, s)] = 0
    ABS[(b, a, -s)] = 0

    cnt = pow(2, p, MOD) + pow(2, n, MOD) - 1
    ans = (ans * cnt) % MOD

print((ans - 1) % MOD)
