import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd

MOD = 10**9 + 7

N = int(input())

zero = 0
counter0 = defaultdict(int)
counter1 = defaultdict(int)
for i in range(N):
    A, B = map(int, input().split())
    if A == B == 0:
        zero += 1
        continue
    g = gcd(A, B)
    A //= g  # 既約分数に
    B //= g

    if A < 0:
        A *= -1
        B *= -1
    if A == 0 and B > 0:  # A, B = 0, -1に
        B *= -1
    
    if B <= 0:  # 分数A/Bが負になる場合はcounter0でカウント
        counter0[(A, -B)] += 1
        counter1[(-B, A)] += 0  # 初期化
    else:
        counter1[(A, B)] += 1

ans = 1
for k, v in counter1.items():
    A, B = k
    j = counter0[(B, A)]
    ans *= pow(2, v, MOD) + pow(2, j, MOD) - 1

    ans %= MOD

ans += zero
ans -= 1
ans %= MOD

print(ans)