import math
import numpy as np
import queue
from collections import deque
import heapq
mod = 10**9+7
ans = 1

def twoxxn(t,mod):
    ni = t
    an = 1
    n2 = 2
    while ni > 0:
        if ni%2 == 1:
            an = (an*n2)%mod
        n2 = (n2**2)%mod
        ni //= 2
    return an

n = int(input())
d = dict()
for i in range(n):
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        continue
    if a == 0:
        b = 1
        g = 1
    elif b == 0:
        a = 1
        g = 1
    else:
        g = math.gcd(abs(a),abs(b))
    if a < 0 :
        a = -a
        b = -b
    p1 = a//g, b//g
    if p1 in d:
        d[p1] += 1
    else:
        d[p1] = 1

for (i0, i1) in d.keys():
    din = d[(i0,i1)]
    if din == 0:
        continue
    if i1 < 0:
        i00 = -i0
        i10 = -i1
    else:
        i00 = i0
        i10 = i1
    if (i10,-i00) in d.keys():
        aaa = (twoxxn(d[(i10,-i00)],mod)+twoxxn(din,mod)-1)%mod
        ans = (ans*aaa)%mod
        d[(i10,-i00)] = 0
    else:
        ans = (ans*twoxxn(din,mod))%mod

if len(d.keys()) == 0:
    print(1)
    exit()

ans = (ans-1)%mod
print(ans)
