N = int(input())
mod = 10 **9 + 7

def equal(item0, item1, delta = 10 ** (-18)):
    if abs(item0 - item1) < delta:
        return True
    else:
        return False
def bigger(item0, item1, delta = 10** (-18)):
    if item0 -item1 > delta:
        return True
    else:
        return False
bitlist = [1]
for k in range(N):
    bitlist.append(bitlist[-1]*2%mod)


liABplus = []
liBAplus = []
from bisect import insort
for _ in range(N):
    A, B = map(int, input().split())
    if A*B > 0:
        insort(liABplus, A/B)
    else:
        insort(liBAplus, -B/A)
def make_count(list):
    k = 0
    lis = []
    while k < len(list):
        cnt = 1
        while k+1 < len(list):
            if equal(list[k], list[k+1]):
                cnt += 1
                k += 1
                continue
            else:
                break
        lis.append([list[k], cnt])
        k += 1
    return lis

liABplus = make_count(liABplus)
liBAplus = make_count(liBAplus)

from collections import deque
liABplus = deque(liABplus)
liBAplus = deque(liBAplus)
ans = bitlist[N]-1 #all pattern
flag = True
eqpair = []
while liABplus and liBAplus:
    if flag:
        AB = liABplus.popleft()
        BA = liBAplus.popleft()
    if equal(AB[0], BA[0]):
        eqpair.append([AB[1], BA[1]])
        if liABplus and liBAplus:
            flag = True
            continue
        else:
            break
    elif bigger(AB[0], BA[0]):
        if liBAplus:
            BA = liBAplus.popleft()
            flag = False
            continue
        else:
            break
    else:
        if liABplus:
            AB = liABplus.popleft()
            flag = False
            continue
        else:
            break

minus = 0
from itertools import combinations
for k in range(1, len(eqpair)+1):
    for item in combinations(eqpair, k):
        sgn = (-1)**k
        ideal = 1
        cnt = 0
        for i in item:
            cnt += i[0] + i[1]
            ideal *= bitlist[i[0]]-1
            ideal %= mod
            ideal *= bitlist[i[1]]-1
            ideal %= mod
        ideal *= bitlist[N-cnt]
        ideal %= mod
        ans += sgn*ideal
        ans %= mod
print(ans)

