# 解説AC
from math import gcd
from collections import defaultdict
import sys

input = sys.stdin.buffer.readline

mod = 10 ** 9 + 7
n = int(input())
cnt = 0
cnt += n
zerocnt = 0
kumi = defaultdict(int)
for i in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zerocnt += 1
        continue
    elif b == 0:
        kumi[(1, 0)] += 1
        continue
    elif a == 0:
        kumi[(0, -1)] += 1
        continue
    g = gcd(a, b)
    a //= g
    b //= g
    if a < 0:
        a *= -1
        b *= -1
    kumi[(a, b)] += 1
ans = 1
cnt -= zerocnt
for a, b in kumi.keys():
    if b <= 0:
        continue
    s = 0
    t = 0
    if (a, b) in kumi:
        s += kumi[(a, b)]
    else:
        continue
    if (b, -a) in kumi:
        t = kumi[(b, -a)]
    else:
        continue
    ans *= pow(2, (s + t), mod) - (pow(2, s, mod) - 1) * (pow(2, t, mod) - 1)
    ans %= mod
    cnt -= s + t
if cnt > 0:
    ans *= pow(2, cnt, mod)
    ans %= mod
print((ans - 1) % mod)
