from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18
SIZE = 3 * 10 ** 5

g1, g2, inv = [1, 1], [1, 1], [0, 1]
for i in range(2, SIZE + 1):
    g1.append((g1[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inv[-1]) % MOD)
    
def comb(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % MOD

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

cnt = defaultdict(int)
zero = 0
for a, b in AB:
    if a != 0 and b != 0:
        cnt[b / a] += 1
    else:
        zero += 1
#print(cnt)


answer = 1
rest = N

answer *= 1 + zero
rest -= zero
#print(answer)

cnt2 = defaultdict(int)
for a, b in AB:
    if a != 0 and b != 0 and b / a > 0:
        if cnt[b / a] and cnt[- a / b] and cnt2[b / a] == 0:
            cnt2[b / a] = 1
            rest -= cnt[b / a] + cnt[- a / b]
            answer *= pow(2, cnt[b / a] + cnt[- a / b], MOD) - (pow(2, cnt[- a / b], MOD) - 1) * (pow(2, cnt[b / a], MOD) - 1) 
            answer %= MOD
            #print(answer)
answer *= pow(2, rest, MOD)
answer -= 1
answer %= MOD

print(answer)