from math import gcd
from collections import defaultdict


def helper(s):
    a,b = map(int,s.split())
    if a == 0 and b == 0:
        return (0, 0, 0)
    elif a == 0:
        return (1, 1, 0)
    elif b == 0:
        return (-1, 0, 1)

    g = gcd(a,b)
    sign = 1 if a*b > 0 else -1
    return (sign, abs(a//g), abs(b//g))

MOD = 10**9+7
# mを法とするときのa^n
def modpow(a,n):
    res = 1
    t = a
    while n:
        if n%2:
            res = (res*t)%MOD
        t = (t*t)%MOD
        n //= 2
    return res


N = int(input())
counter = defaultdict(int)
for _ in range(N):
    counter[helper(input())] += 1

goods = 1

for (a,b,c),s in tuple(counter.items()):
    if a == 0:
        continue

    s = counter[(a,b,c)]
    t = counter[(-a,c,b)]
    if a < 0 and t > 0:
        continue
    if t == 0:
        goods *= modpow(2,s)
    else:
        goods *= modpow(2,s)+modpow(2,t)-1
    goods %= MOD

goods -= 1
goods %= MOD

print(goods)