import math
n = int(input())
mod_num = 1000000007

vList = []
cList = []
num_zero = 0
num_b_zero = 0
num_free = 0


def combo(x: int) -> int:
    '''
    :param x:
    :param y:
    :return: int
    '''
    return 2**x


for i in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        num_zero += 1
    g = math.gcd(a, b)
    a, b = a/g, b/g
    if b == 0:
        num_b_zero += 1
    else:
        K_value = a/b
        # already exist
        if vList.count(K_value):
            index = vList.index(K_value)
            cList[index] += 1
        # new value
        else:
            vList.append(K_value)
            cList.append(1)
# print(vList)
# print(cList)
counter = 0
para = 0
oList = []
# (0,0)
counter += num_zero % mod_num
# (a,0) and (0,b)
if vList.count(0):
    vList.index(0)
    # print('(0,b) has ', cList[index])
    para += combo(cList[index])
if num_b_zero:
    para += combo(num_b_zero)
else:
    para = 1
# print('half 0 has ', para)
oList.append(para)
# normal
solved = []
for value, count in zip(vList, cList):
    if value not in solved:
        upside = -1/value
        # anti exist
        if vList.count(upside):
            solved.append(upside)
            index = vList.index(upside)
            # print(value, 'has anti ', upside, 'number', count, '-', cList[index])
            para = combo(count) + combo(cList[index])-1
            oList.append(para)
        # free value
        else:
            num_free += count
            # print(value, 'is free,now has free fish :', num_free)

oList.append(combo(num_free))
# print('count:')

result = 1
for i in oList:
    result *= i
result += counter
result -= 1
print(result % mod_num)
