import sys
def input(itr=iter(sys.stdin.readlines())):  # pylint: disable= redefined-builtin
    return next(itr).rstrip('\n\r')
###############################################################################

import collections
import math as m
from fractions import Fraction

MOD = 1000000007

N = int(input())
Sardine = collections.namedtuple("Sardine", "A B")
sardines = [Sardine(*map(int, input().split())) for _ in range(N)]

def slope(sardine):
    if sardine.A == sardine.B == 0:
        return None
    elif sardine.B == 0:
        return m.inf
    else:
        return Fraction(sardine.A, sardine.B)

def perpendicular(slope):
    if slope == 0:
        return m.inf
    elif slope == m.inf:
        return 0
    else:
        return -1 / slope

groups = collections.Counter(slope(s) for s in sardines)
del groups[None]

ways = 1
while groups:
    slope, count = groups.popitem()
    perp_slope = perpendicular(slope)
    perp_count = groups[perp_slope]

    ways *= (1<<count + 1<<perp_count - 1) % MOD
    ways %= MOD

    del groups[perp_slope]

print((ways-1)%MOD)
